Antoine du Hamel
5703147470
tools: enable linter in test/fixtures/source-map/output
...
PR-URL: https://github.com/nodejs/node/pull/57700
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-05-19 12:13:51 +02:00
Chengzhong Wu
d5bf3db0cf
lib: allow skipping source maps in node_modules
...
Files in `node_modules` are not authored by the user directly and the
original sources are less relevant to the user.
Skipping source maps in `node_modules` improves the general
performance. Add `module.setSourceMapsSupport(enabled, options)` to
skip source maps in `node_modules` if it is needed. This moves
all source maps related API to `node:module` and this a step to
promote the source maps API to stable.
PR-URL: https://github.com/nodejs/node/pull/56639
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-02-06 01:10:44 +01:00
Chengzhong Wu
d8375d6236
lib: decorate async stack trace in source maps
...
Decorate stack frame with 'async' and 'new' keywords based on the type
of the call site info.
PR-URL: https://github.com/nodejs/node/pull/53860
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-07-28 09:51:30 +02:00
theanarkh
515dd24ee7
lib: fix timer leak
...
PR-URL: https://github.com/nodejs/node/pull/53337
Fixes: https://github.com/nodejs/node/issues/53335
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
2024-06-20 14:40:37 +02:00
Chengzhong Wu
fe007cd1b4
lib: allow CJS source map cache to be reclaimed
...
Unifies the CJS and ESM source map cache map with SourceMapCacheMap
and allows the CJS cache entries to be queried more efficiently with
a source url without iteration on an IterableWeakMap.
Add a test to verify that the CJS source map cache entry can be
reclaimed.
PR-URL: https://github.com/nodejs/node/pull/51711
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-06-01 10:55:07 +02:00
unbyte
fc0f2cf475
lib,src: extract sourceMappingURL from module
...
PR-URL: https://github.com/nodejs/node/pull/51690
Refs: https://github.com/nodejs/node/issues/51522
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2024-02-26 11:55:30 +08:00
Chengzhong Wu
147abb99d1
lib: expose default prepareStackTrace
...
Expose the default prepareStackTrace implementation as
`Error.prepareStackTrace` so that userland can chain up formatting of
stack traces with built-in source maps support.
PR-URL: https://github.com/nodejs/node/pull/50827
Fixes: https://github.com/nodejs/node/issues/50733
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-12-21 16:56:35 +00:00
华
77e3dfca5c
lib: don't parse windows drive letters as schemes
...
We were incorrectly parsing windows drive letters as schemes. This was
polluting the source map cache with malformed file paths.
Fixes: https://github.com/nodejs/node/issues/50523
PR-URL: https://github.com/nodejs/node/pull/50580
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-12-05 09:24:14 +00:00
Geoffrey Booth
a71e3a65bb
test: fix edge snapshot stack traces
...
PR-URL: https://github.com/nodejs/node/pull/49659
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-09-17 20:59:41 +00:00
Geoffrey Booth
f42a103991
esm: require braces for modules code
...
PR-URL: https://github.com/nodejs/node/pull/49657
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-09-15 19:18:13 +00:00
Yiyun Lei
9cd70f4c0e
test: migrate message source map tests from Python to JS
...
Migrate the remaining source map tests in the `test/message` folder
from Python to JS.
Fixes: https://github.com/nodejs/node/issues/47707
test: migrate message source map tests from Python to JS
PR-URL: https://github.com/nodejs/node/pull/49238
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-08-29 10:36:23 +00:00
翠 / green
6bb400f8ec
lib: add api to detect whether source-maps are enabled
...
Add `process.sourceMapsEnabled` to detect
whether source-maps are enabled.
Fixes: https://github.com/nodejs/node/issues/46304
PR-URL: https://github.com/nodejs/node/pull/46391
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-08-17 08:42:12 +00:00
Moshe Atlow
b6738c1af0
test: migrate message tests to use assertSnapshot
...
PR-URL: https://github.com/nodejs/node/pull/47498
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-04-27 06:41:58 +00:00
MURAKAMI Masahiko
f4815fcd76
test: improve lib/internal/source_map/source_map.js coverage
...
PR-URL: https://github.com/nodejs/node/pull/42771
Refs: https://coverage.nodejs.org/coverage-0699150267c08fb2/lib/internal/source_map/source_map.js.html#L154
Refs: https://coverage.nodejs.org/coverage-0699150267c08fb2/lib/internal/source_map/source_map.js.html#L165
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com >
2022-10-03 07:47:32 +00:00
Alan Agius
e6018e2864
lib: don't match sourceMappingURL in strings
...
Prior to this change `sourceMappingURL` in string where being matched
by the RegExp which caused sourcemaps not be loaded when using the
`--enable-source-maps` flag. This commit changes the RegExp to match
the last occurrence.
Fixes: https://github.com/nodejs/node/issues/44654
PR-URL: https://github.com/nodejs/node/pull/44658
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-09-26 00:11:18 +08:00
legendecas
0a2c910ae9
src,lib: print prinstine source when source map source not found
...
Print unmapped source lines when the source map source is not
found. Error stacks should be correctly mapped even when the
source is absent.
PR-URL: https://github.com/nodejs/node/pull/44052
Refs: https://github.com/nodejs/node/pull/44019
Reviewed-By: Ben Coe <bencoe@gmail.com >
2022-08-06 19:56:27 +08:00
Fabian Cook
154fa4132b
lib: source maps filter null prefix
...
Fixes: https://github.com/nodejs/node/issues/42417
PR-URL: https://github.com/nodejs/node/pull/42522
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-04-03 17:21:38 +01:00
bcoe
663d7e9fb2
errors: don't throw TypeError on missing export
...
Logic in module_job.js assumes detailed stack trace from node_errors.cc
which is not populated when --enable-source-maps is set.
Fixes #38790
PR-URL: https://github.com/nodejs/node/pull/39017
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
2021-06-28 15:35:16 -04:00
bcoe
c5cc3d4a8b
errors: don't rekey on primitive type
...
If an error is thrown before a module is loaded, we attempt to cache
source map against error object, rather than module object. We
can't do this if the error is a primitive type
Fixes #38945
PR-URL: https://github.com/nodejs/node/pull/39025
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-21 18:35:34 -07:00
bcoe
09fd8f13c8
errors: display original symbol name
...
If symbol names array has been populated in source map, include
original symbol name in error message.
Fixes https://github.com/nodejs/node/issues/35325
PR-URL: https://github.com/nodejs/node/pull/36042
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2020-12-01 07:23:56 -08:00
bcoe
8fa90358d7
module: refactor to use iterable-weak-map
...
Using an iterable WeakMap (a data-structure that uses WeakRef and
WeakMap), we are able to: stop relying on Module._cache to
serialize source maps; stop requiring an error object when calling
findSourceMap().
PR-URL: https://github.com/nodejs/node/pull/35915
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-11-06 12:47:23 -08:00
bcoe
26fcdb655e
errors: do not call resolve on URLs with schemes
...
We were incorrectly trying to run path.resolve on absolute
sources URLs. This was breaking webpack:// URLs in stack
trace output.
Refs: https://github.com/nodejs/node/issues/35325
PR-URL: https://github.com/nodejs/node/pull/35903
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-11-02 16:28:08 -08:00
bcoe
458677f5ef
errors: print original exception context
...
When --enable-source-maps is set, the error context displayed
above the stack trace now shows original source rather than
transpiled.
PR-URL: https://github.com/nodejs/node/pull/33491
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2020-05-24 22:03:34 -07:00
telenord
d90219d9ad
test: test cover cases when trace is empty
...
cover prepare_stack_trace in case when trace is empty
PR-URL: https://github.com/nodejs/node/pull/30311
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-11-24 11:48:28 +05:30
Nolik
eb773217ae
process: add coverage tests for sourceMapFromDataUrl method
...
PR-URL: https://github.com/nodejs/node/pull/30319
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Coe <bencoe@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Masashi Hirano <shisama07@gmail.com >
2019-11-09 05:53:55 -08:00
bcoe
e1e2f669f6
process: add source-map support to stack traces
...
PR-URL: https://github.com/nodejs/node/pull/29564
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-10-05 17:08:00 -07:00
Benjamin Coe
8f06773a8c
process: initial SourceMap support via NODE_V8_COVERAGE
...
PR-URL: https://github.com/nodejs/node/pull/28960
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
2019-09-22 00:39:41 +02:00