@@ -58,6 +58,9 @@ executed in specific contexts.
58
58
<!-- YAML
59
59
added: v0.3.1
60
60
changes:
61
+ - version: REPLACEME
62
+ pr-url: https://github.com/nodejs/node/pull/REPLACEME
63
+ description: Added support for experimental strip types.
61
64
- version:
62
65
- v21.7.0
63
66
- v20.12.0
@@ -107,6 +110,16 @@ changes:
107
110
experimental modules API. We do not recommend using it in a production
108
111
environment. For detailed information, see
109
112
[ Support of dynamic ` import() ` in compilation APIs] [ ] .
113
+ * ` transform ` {Object} An object containing options for type stripping.
114
+ Only available when the ` --experimental-strip-types ` flag is enabled.
115
+ * ` mode ` {string} The mode of type stripping. Possible values are:
116
+ * ` strip-only ` : Strip all types, without transforming TypeScript only features,
117
+ for more information read [ type-stripping] [ ] .
118
+ * ` transform ` : Transforms TypeScript features, for info read [ transform TypeScript features] [ ] .
119
+ * ` sourceMap ` {boolean} Generate source maps for the transformed code, if ` mode ` is ` transform ` ,
120
+ otherwise it is not necessary.
121
+ The filename for the source map is the same as the filename of the script.
122
+ ** Default:** ` false ` .
110
123
111
124
If ` options ` is a string, then it specifies the filename.
112
125
@@ -990,6 +1003,9 @@ const vm = require('node:vm');
990
1003
<!-- YAML
991
1004
added: v10.10.0
992
1005
changes:
1006
+ - version: REPLACEME
1007
+ pr-url: https://github.com/nodejs/node/pull/REPLACEME
1008
+ description: Added support for experimental strip types.
993
1009
- version:
994
1010
- v21.7.0
995
1011
- v20.12.0
@@ -1044,6 +1060,16 @@ changes:
1044
1060
* `contextExtensions` {Object\[]} An array containing a collection of context
1045
1061
extensions (objects wrapping the current scope ) to be applied while
1046
1062
compiling. **Default:** `[]`.
1063
+ * `transform` {Object } An object containing options for type stripping.
1064
+ Only available when the ` --experimental-strip-types` flag is enabled.
1065
+ * ` mode` {string} The mode of type stripping . Possible values are:
1066
+ * ` strip-only` : Strip all types, without transforming TypeScript only features,
1067
+ for more information read [type- stripping][].
1068
+ * ` transform` : Transforms TypeScript features, for info read [transform TypeScript features][].
1069
+ * ` sourceMap` {boolean} Generate source maps for the transformed code, if ` mode` is ` transform` ,
1070
+ otherwise it is not necessary.
1071
+ The filename for the source map is the same as the filename of the script.
1072
+ ** Default: ** ` false` .
1047
1073
* ` importModuleDynamically`
1048
1074
{Function | vm .constants .USE \_MAIN \_CONTEXT \_DEFAULT \_LOADER }
1049
1075
Used to specify the how the modules should be loaded during the evaluation of
@@ -1287,6 +1313,9 @@ vm.measureMemory({ mode: 'detailed', execution: 'eager' })
1287
1313
<!-- YAML
1288
1314
added: v0.3 .1
1289
1315
changes:
1316
+ - version: REPLACEME
1317
+ pr- url: https: // github.com/nodejs/node/pull/REPLACEME
1318
+ description: Added support for experimental strip types.
1290
1319
- version:
1291
1320
- v21.7 .0
1292
1321
- v20.12 .0
@@ -1335,6 +1364,16 @@ changes:
1335
1364
experimental modules API. We do not recommend using it in a production
1336
1365
environment. For detailed information, see
1337
1366
[Support of dynamic `import()` in compilation APIs][].
1367
+ * `transform` {Object} An object containing options for type stripping.
1368
+ Only available when the `--experimental-strip-types` flag is enabled.
1369
+ * `mode` {string} The mode of type stripping. Possible values are:
1370
+ * `strip-only`: Strip all types, without transforming TypeScript only features,
1371
+ for more information read [type-stripping][].
1372
+ * `transform`: Transforms TypeScript features, for info read [transform TypeScript features][].
1373
+ * `sourceMap` {boolean} Generate source maps for the transformed code, if `mode` is `transform`,
1374
+ otherwise it is not necessary.
1375
+ The filename for the source map is the same as the filename of the script.
1376
+ **Default:** `false`.
1338
1377
1339
1378
The `vm.runInContext()` method compiles `code`, runs it within the context of
1340
1379
the `contextifiedObject`, then returns the result. Running code does not have
@@ -1364,6 +1403,9 @@ console.log(contextObject);
1364
1403
<!-- YAML
1365
1404
added: v0.3.1
1366
1405
changes:
1406
+ - version: REPLACEME
1407
+ pr-url: https://github.com/nodejs/node/pull/REPLACEME
1408
+ description: Added support for experimental strip types.
1367
1409
- version:
1368
1410
- v22.8.0
1369
1411
- v20.18.0
@@ -1443,6 +1485,16 @@ changes:
1443
1485
scheduled through ` Promise` s and ` async function` s) will be run immediately
1444
1486
after the script has run . They are included in the ` timeout` and
1445
1487
` breakOnSigint` scopes in that case.
1488
+ * ` transform` {Object } An object containing options for type stripping.
1489
+ Only available when the ` --experimental-strip-types` flag is enabled.
1490
+ * ` mode` {string} The mode of type stripping . Possible values are:
1491
+ * ` strip-only` : Strip all types, without transforming TypeScript only features,
1492
+ for more information read [type- stripping][].
1493
+ * ` transform` : Transforms TypeScript features, for info read [transform TypeScript features][].
1494
+ * ` sourceMap` {boolean} Generate source maps for the transformed code, if ` mode` is ` transform` ,
1495
+ otherwise it is not necessary.
1496
+ The filename for the source map is the same as the filename of the script.
1497
+ ** Default: ** ` false` .
1446
1498
* Returns: {any} the result of the very last statement executed in the script.
1447
1499
1448
1500
This method is a shortcut to
@@ -1486,6 +1538,9 @@ const frozenContext = vm.runInNewContext('Object.freeze(globalThis); globalThis;
1486
1538
<!-- YAML
1487
1539
added: v0.3.1
1488
1540
changes:
1541
+ - version: REPLACEME
1542
+ pr-url: https://github.com/nodejs/node/pull/REPLACEME
1543
+ description: Added support for experimental strip types.
1489
1544
- version:
1490
1545
- v21.7.0
1491
1546
- v20.12.0
@@ -1532,6 +1587,16 @@ changes:
1532
1587
experimental modules API . We do not recommend using it in a production
1533
1588
environment . For detailed information, see
1534
1589
[Support of dynamic ` import()` in compilation APIs][].
1590
+ * ` transform` {Object } An object containing options for type stripping.
1591
+ Only available when the ` --experimental-strip-types` flag is enabled.
1592
+ * ` mode` {string} The mode of type stripping . Possible values are:
1593
+ * ` strip-only` : Strip all types, without transforming TypeScript only features,
1594
+ for more information read [type- stripping][].
1595
+ * ` transform` : Transforms TypeScript features, for info read [transform TypeScript features][].
1596
+ * ` sourceMap` {boolean} Generate source maps for the transformed code, if ` mode` is ` transform` ,
1597
+ otherwise it is not necessary.
1598
+ The filename for the source map is the same as the filename of the script.
1599
+ ** Default: ** ` false` .
1535
1600
* Returns: {any} the result of the very last statement executed in the script.
1536
1601
1537
1602
` vm.runInThisContext()` compiles ` code` , runs it within the context of the
@@ -1982,3 +2047,5 @@ const { Script, SyntheticModule } = require('node:vm');
1982
2047
[global object]: https://es5.github.io/#x15.1
1983
2048
[indirect ` eval ()` call]: https://es5.github.io/#x10.4.2
1984
2049
[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin
2050
+ [transform TypeScript features]: typescript.md#typescript-features
2051
+ [type-stripping]: typescript.md#type-stripping
0 commit comments