@@ -177,6 +177,13 @@ added:
177
177
- v20.6.0
178
178
- v18.19.0
179
179
changes:
180
+ - version:
181
+ - v23.6.1
182
+ - v22.13.1
183
+ - v20.18.2
184
+ pr-url: https://github.com/nodejs-private/node-private/pull/629
185
+ description: Using this feature with the permission model enabled requires
186
+ passing ` -- allow- worker` .
180
187
- version:
181
188
- v20.8.0
182
189
- v18.19.0
@@ -205,6 +212,8 @@ changes:
205
212
Register a module that exports [hooks][] that customize Node.js module
206
213
resolution and loading behavior. See [Customization hooks][].
207
214
215
+ This feature requires ` --allow-worker` if used with the [Permission Model][].
216
+
208
217
### ` module.registerHooks(options)`
209
218
210
219
<!-- YAML
@@ -1587,6 +1596,20 @@ import { findSourceMap, SourceMap } from 'node:module';
1587
1596
const { findSourceMap , SourceMap } = require (' node:module' );
1588
1597
` ` `
1589
1598
1599
+ ### ` module .getSourceMapsSupport ()`
1600
+
1601
+ <!-- YAML
1602
+ added: REPLACEME
1603
+ -->
1604
+
1605
+ * Returns: {Object}
1606
+ * ` enabled` {boolean} If the source maps support is enabled
1607
+ * ` nodeModules` {boolean} If the support is enabled for files in ` node_modules` .
1608
+ * ` generatedCode` {boolean} If the support is enabled for generated code from ` eval` or ` new Function ` .
1609
+
1610
+ This method returns whether the [Source Map v3][Source Map] support for stack
1611
+ traces is enabled.
1612
+
1590
1613
<!-- Anchors to make sure old links find a target -->
1591
1614
1592
1615
<a id="module_module_findsourcemap_path_error"></a>
@@ -1606,6 +1629,31 @@ added:
1606
1629
` path` is the resolved path for the file for which a corresponding source map
1607
1630
should be fetched.
1608
1631
1632
+ ### ` module .setSourceMapsSupport (enabled[, options])`
1633
+
1634
+ <!-- YAML
1635
+ added: REPLACEME
1636
+ -->
1637
+
1638
+ * ` enabled` {boolean} Enable the source map support.
1639
+ * ` options` {Object} Optional
1640
+ * ` nodeModules` {boolean} If enabling the support for files in
1641
+ ` node_modules` . **Default:** ` false ` .
1642
+ * ` generatedCode` {boolean} If enabling the support for generated code from
1643
+ ` eval` or ` new Function ` . **Default:** ` false ` .
1644
+
1645
+ This function enables or disables the [Source Map v3][Source Map] support for
1646
+ stack traces.
1647
+
1648
+ It provides same features as launching Node.js process with commandline options
1649
+ ` -- enable- source- maps` , with additional options to alter the support for files
1650
+ in ` node_modules` or generated codes.
1651
+
1652
+ Only source maps in JavaScript files that are loaded after source maps has been
1653
+ enabled will be parsed and loaded. Preferably, use the commandline options
1654
+ ` -- enable- source- maps` to avoid losing track of source maps of modules loaded
1655
+ before this API call.
1656
+
1609
1657
### Class: ` module .SourceMap `
1610
1658
1611
1659
<!-- YAML
@@ -1705,6 +1753,8 @@ returned object contains the following keys:
1705
1753
[Conditional exports]: packages.md#conditional-exports
1706
1754
[Customization hooks]: #customization-hooks
1707
1755
[ES Modules]: esm.md
1756
+ [Permission Model]: permissions.md#permission-model
1757
+ [Source Map]: https://sourcemaps.info/spec.html
1708
1758
[Source map v3 format]: https://sourcemaps.info/spec.html#h.mofvlxcwqzej
1709
1759
[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
1710
1760
[V8 code cache]: https://v8.dev/blog/code-caching-for-devs
0 commit comments