doc,lib: update source map links to ECMA426

PR-URL: https://github.com/nodejs/node/pull/58597
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Chengzhong Wu 2025-06-08 11:30:11 +01:00 committed by Antoine du Hamel
parent 1ca253c363
commit 73a97d47f3
No known key found for this signature in database
GPG Key ID: 21D900FFDB233756
6 changed files with 21 additions and 16 deletions

View File

@ -733,7 +733,7 @@ changes:
description: This API is no longer experimental.
-->
Enable [Source Map v3][Source Map] support for stack traces.
Enable [Source Map][] support for stack traces.
When using a transpiler, such as TypeScript, stack traces thrown by an
application reference the transpiled code, not the original source position.
@ -3850,7 +3850,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
[REPL]: repl.md
[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage
[ShadowRealm]: https://github.com/tc39/proposal-shadowrealm
[Source Map]: https://sourcemaps.info/spec.html
[Source Map]: https://tc39.es/ecma426/
[TypeScript type-stripping]: typescript.md#type-stripping
[V8 Inspector integration for Node.js]: debugger.md#v8-inspector-integration-for-nodejs
[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html

View File

@ -1702,7 +1702,7 @@ Running `node --import 'data:text/javascript,import { register } from "node:modu
or `node --import ./import-map-sync-hooks.js main.js`
should print `some module!`.
## Source map v3 support
## Source Map Support
<!-- YAML
added:
@ -1712,13 +1712,17 @@ added:
> Stability: 1 - Experimental
Helpers for interacting with the source map cache. This cache is
populated when source map parsing is enabled and
Node.js supports TC39 ECMA-426 [Source Map][] format (it was called Source map
revision 3 format).
The APIs in this section are helpers for interacting with the source map
cache. This cache is populated when source map parsing is enabled and
[source map include directives][] are found in a modules' footer.
To enable source map parsing, Node.js must be run with the flag
[`--enable-source-maps`][], or with code coverage enabled by setting
[`NODE_V8_COVERAGE=dir`][].
[`NODE_V8_COVERAGE=dir`][], or be enabled programmatically via
[`module.setSourceMapsSupport()`][].
```mjs
// module.mjs
@ -1812,7 +1816,7 @@ changes:
Creates a new `sourceMap` instance.
`payload` is an object with keys matching the [Source map v3 format][]:
`payload` is an object with keys matching the [Source map format][]:
* `file`: {string}
* `version`: {number}
@ -1903,8 +1907,8 @@ returned object contains the following keys:
[Customization hooks]: #customization-hooks
[ES Modules]: esm.md
[Permission Model]: permissions.md#permission-model
[Source Map]: https://sourcemaps.info/spec.html
[Source map v3 format]: https://sourcemaps.info/spec.html#h.mofvlxcwqzej
[Source Map]: https://tc39.es/ecma426/
[Source map format]: https://tc39.es/ecma426/#sec-source-map-format
[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
[V8 code cache]: https://v8.dev/blog/code-caching-for-devs
[`"exports"`]: packages.md#exports
@ -1920,6 +1924,7 @@ returned object contains the following keys:
[`module.enableCompileCache()`]: #moduleenablecompilecachecachedir
[`module.flushCompileCache()`]: #moduleflushcompilecache
[`module.getCompileCacheDir()`]: #modulegetcompilecachedir
[`module.setSourceMapsSupport()`]: #modulesetsourcemapssupportenabled-options
[`module`]: #the-module-object
[`os.tmpdir()`]: os.md#ostmpdir
[`registerHooks`]: #moduleregisterhooksoptions
@ -1933,7 +1938,7 @@ returned object contains the following keys:
[prefix-only modules]: modules.md#built-in-modules-with-mandatory-node-prefix
[realm]: https://tc39.es/ecma262/#realm
[resolve hook]: #resolvespecifier-context-nextresolve
[source map include directives]: https://sourcemaps.info/spec.html#h.lmz475t4mvbx
[source map include directives]: https://tc39.es/ecma426/#sec-linking-generated-code
[the documentation of `Worker`]: worker_threads.md#new-workerfilename-options
[transferable objects]: worker_threads.md#portpostmessagevalue-transferlist
[transform TypeScript features]: typescript.md#typescript-features

View File

@ -1256,7 +1256,7 @@ This section was moved to
## Source map v3 support
This section was moved to
[Modules: `module` core module](module.md#source-map-v3-support).
[Modules: `module` core module](module.md#source-map-support).
<!-- Anchors to make sure old links find a target -->

View File

@ -4033,7 +4033,7 @@ added:
* `val` {boolean}
This function enables or disables the [Source Map v3][Source Map] support for
This function enables or disables the [Source Map][] support for
stack traces.
It provides same features as launching Node.js process with commandline options
@ -4084,7 +4084,7 @@ added:
* {boolean}
The `process.sourceMapsEnabled` property returns whether the
[Source Map v3][Source Map] support for stack traces is enabled.
[Source Map][] support for stack traces is enabled.
## `process.stderr`
@ -4523,7 +4523,7 @@ cases:
[Permission Model]: permissions.md#permission-model
[Readable]: stream.md#readable-streams
[Signal Events]: #signal-events
[Source Map]: https://sourcemaps.info/spec.html
[Source Map]: https://tc39.es/ecma426/
[Stream compatibility]: stream.md#compatibility-with-older-nodejs-versions
[TTY]: tty.md#tty
[Writable]: stream.md#writable-streams

View File

@ -10,7 +10,7 @@ const {
StringPrototypeSplit,
} = primordials;
// See https://sourcemaps.info/spec.html for SourceMap V3 specification.
// See https://tc39.es/ecma426/ for SourceMap V3 specification.
const { Buffer } = require('buffer');
let debug = require('internal/util/debuglog').debuglog('source_map', (fn) => {
debug = fn;

View File

@ -273,7 +273,7 @@ function nextdir() {
// Does not attempt to apply path resolution logic to absolute URLs
// with schemes.
// Refs: https://github.com/webpack/webpack/issues/9601
// Refs: https://sourcemaps.info/spec.html#h.75yo6yoyk7x5
// Refs: https://tc39.es/ecma426/#sec-sources
{
const output = spawnSync(process.execPath, [
'--enable-source-maps',