GeezerVison is showing github.com — module: unflag --experimental-strip-types · nodejs/node@e5ba216
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: benchmark/ts/strip-typescript.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { | 12 | 12 | filepath: [ts, js], | 13 | 13 | n: [1e4], | 14 | 14 | }, { | 15 | | - flags: ['--experimental-strip-types', '--disable-warning=ExperimentalWarning'], | | 15 | + flags: ['--disable-warning=ExperimentalWarning'], | 16 | 16 | }); | 17 | 17 |
| 18 | 18 | async function main({ n, filepath }) { | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/cli.md +23-19Lines changed: 23 additions & 19 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -779,7 +779,7 @@ Any query parameter or hash in the URL will be accessible via [`import.meta.url` | 779 | 779 |
| 780 | 780 | ```bash | 781 | 781 | node --entry-url 'file:///path/to/file.js?queryparams=work#and-hashes-too' | 782 | | -node --entry-url --experimental-strip-types 'file.ts?query#hash' | | 782 | +node --entry-url 'file.ts?query#hash' | 783 | 783 | node --entry-url 'data:text/javascript,console.log("Hello")' | 784 | 784 | ``` | 785 | 785 |
| @@ -879,8 +879,8 @@ On Windows, using `cmd.exe` a single quote will not work correctly because it | 879 | 879 | only recognizes double `"` for quoting. In Powershell or Git bash, both `'` | 880 | 880 | and `"` are usable. | 881 | 881 |
| 882 | | -It is possible to run code containing inline types by passing | 883 | | -[`--experimental-strip-types`][]. | | 882 | +It is possible to run code containing inline types unless the | | 883 | +[`--no-experimental-strip-types`][] flag is provided. | 884 | 884 |
| 885 | 885 | ### `--experimental-addon-modules` | 886 | 886 |
| @@ -1020,17 +1020,6 @@ added: | 1020 | 1020 |
| 1021 | 1021 | Use this flag to enable [ShadowRealm][] support. | 1022 | 1022 |
| 1023 | | -### `--experimental-strip-types` | 1024 | | - | 1025 | | -<!-- YAML | 1026 | | -added: v22.6.0 | 1027 | | ---> | 1028 | | - | 1029 | | -> Stability: 1.1 - Active development | 1030 | | -
| 1031 | | -Enable experimental type-stripping for TypeScript files. | 1032 | | -For more information, see the [TypeScript type-stripping][] documentation. | 1033 | | - | 1034 | 1023 | ### `--experimental-test-coverage` | 1035 | 1024 |
| 1036 | 1025 | <!-- YAML | @@ -1071,7 +1060,7 @@ added: v22.7.0 | 1071 | 1060 | > Stability: 1.1 - Active development | 1072 | 1061 |
| 1073 | 1062 | Enables the transformation of TypeScript-only syntax into JavaScript code. | 1074 | | -Implies `--experimental-strip-types` and `--enable-source-maps`. | | 1063 | +Implies `--enable-source-maps`. | 1075 | 1064 |
| 1076 | 1065 | ### `--experimental-vm-modules` | 1077 | 1066 |
| @@ -1382,10 +1371,10 @@ added: v12.0.0 | 1382 | 1371 |
| 1383 | 1372 | This configures Node.js to interpret `--eval` or `STDIN` input as CommonJS or | 1384 | 1373 | as an ES module. Valid values are `"commonjs"`, `"module"`, `"module-typescript"` and `"commonjs-typescript"`. | 1385 | | -The `"-typescript"` values are available only in combination with the flag `--experimental-strip-types`. | | 1374 | +The `"-typescript"` values are not available with the flag `--no-experimental-strip-types`. | 1386 | 1375 | The default is `"commonjs"`. | 1387 | 1376 |
| 1388 | | -If `--experimental-strip-types` is enabled and `--input-type` is not provided, | | 1377 | +If `--input-type` is not provided, | 1389 | 1378 | Node.js will try to detect the syntax with the following steps: | 1390 | 1379 |
| 1391 | 1380 | 1. Run the input as CommonJS. | @@ -1660,6 +1649,21 @@ changes: | 1660 | 1649 |
| 1661 | 1650 | Disable the experimental [`node:sqlite`][] module. | 1662 | 1651 |
| | 1652 | +### `--no-experimental-strip-types` | | 1653 | + | | 1654 | +<!-- YAML | | 1655 | +added: v22.6.0 | | 1656 | +changes: | | 1657 | + - version: REPLACEME | | 1658 | + pr-url: https://github.com/nodejs/node/pull/56350 | | 1659 | + description: Type stripping is enabled by default. | | 1660 | +--> | | 1661 | + | | 1662 | +> Stability: 1.1 - Active development | | 1663 | +
| | 1664 | +Disable experimental type-stripping for TypeScript files. | | 1665 | +For more information, see the [TypeScript type-stripping][] documentation. | | 1666 | + | 1663 | 1667 | ### `--no-experimental-websocket` | 1664 | 1668 |
| 1665 | 1669 | <!-- YAML | @@ -3087,7 +3091,6 @@ one is included in the list below. | 3087 | 3091 | * `--experimental-require-module` | 3088 | 3092 | * `--experimental-shadow-realm` | 3089 | 3093 | * `--experimental-specifier-resolution` | 3090 | | -* `--experimental-strip-types` | 3091 | 3094 | * `--experimental-test-isolation` | 3092 | 3095 | * `--experimental-top-level-await` | 3093 | 3096 | * `--experimental-transform-types` | @@ -3124,6 +3127,7 @@ one is included in the list below. | 3124 | 3127 | * `--no-experimental-global-navigator` | 3125 | 3128 | * `--no-experimental-repl-await` | 3126 | 3129 | * `--no-experimental-sqlite` | | 3130 | +* `--no-experimental-strip-types` | 3127 | 3131 | * `--no-experimental-websocket` | 3128 | 3132 | * `--no-extra-info-on-fatal-exception` | 3129 | 3133 | * `--no-force-async-hooks-checks` | @@ -3648,10 +3652,10 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | 3648 | 3652 | [`--env-file`]: #--env-fileconfig | 3649 | 3653 | [`--experimental-addon-modules`]: #--experimental-addon-modules | 3650 | 3654 | [`--experimental-sea-config`]: single-executable-applications.md#generating-single-executable-preparation-blobs | 3651 | | -[`--experimental-strip-types`]: #--experimental-strip-types | 3652 | 3655 | [`--experimental-wasm-modules`]: #--experimental-wasm-modules | 3653 | 3656 | [`--heap-prof-dir`]: #--heap-prof-dir | 3654 | 3657 | [`--import`]: #--importmodule | | 3658 | +[`--no-experimental-strip-types`]: #--no-experimental-strip-types | 3655 | 3659 | [`--openssl-config`]: #--openssl-configfile | 3656 | 3660 | [`--preserve-symlinks`]: #--preserve-symlinks | 3657 | 3661 | [`--print`]: #-p---print-script | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/process.md +3-2Lines changed: 3 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2021,8 +2021,9 @@ added: v23.0.0 | 2021 | 2021 |
| 2022 | 2022 | * {boolean|string} | 2023 | 2023 |
| 2024 | | -A value that is `"strip"` if Node.js is run with `--experimental-strip-types`, | 2025 | | -`"transform"` if Node.js is run with `--experimental-transform-types`, and `false` otherwise. | | 2024 | +A value that is `"strip"` by default, | | 2025 | +`"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if | | 2026 | +Node.js is run with `--no-experimental-strip-types`. | 2026 | 2027 |
| 2027 | 2028 | ## `process.features.uv` | 2028 | 2029 |
| |
Collapse file Copy file name to clipboardExpand all lines: doc/api/test.md +3-3Lines changed: 3 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -420,8 +420,8 @@ By default, Node.js will run all files matching these patterns: | 420 | 420 | * `**/test.{cjs,mjs,js}` | 421 | 421 | * `**/test/**/*.{cjs,mjs,js}` | 422 | 422 |
| 423 | | -When [`--experimental-strip-types`][] is supplied, the following | 424 | | -additional patterns are matched: | | 423 | +Unless [`--no-experimental-strip-types`][] is supplied, the following | | 424 | +additional patterns are also matched: | 425 | 425 |
| 426 | 426 | * `**/*.test.{cts,mts,ts}` | 427 | 427 | * `**/*-test.{cts,mts,ts}` | @@ -3589,10 +3589,10 @@ added: | 3589 | 3589 | Can be used to abort test subtasks when the test has been aborted. | 3590 | 3590 |
| 3591 | 3591 | [TAP]: https://testanything.org/ | 3592 | | -[`--experimental-strip-types`]: cli.md#--experimental-strip-types | 3593 | 3592 | [`--experimental-test-coverage`]: cli.md#--experimental-test-coverage | 3594 | 3593 | [`--experimental-test-module-mocks`]: cli.md#--experimental-test-module-mocks | 3595 | 3594 | [`--import`]: cli.md#--importmodule | | 3595 | +[`--no-experimental-strip-types`]: cli.md#--no-experimental-strip-types | 3596 | 3596 | [`--test-concurrency`]: cli.md#--test-concurrency | 3597 | 3597 | [`--test-coverage-exclude`]: cli.md#--test-coverage-exclude | 3598 | 3598 | [`--test-coverage-include`]: cli.md#--test-coverage-include | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/typescript.md +5-2Lines changed: 5 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 |
| 3 | 3 | <!-- YAML | 4 | 4 | changes: | | 5 | + - version: REPLACEME | | 6 | + pr-url: https://github.com/nodejs/node/pull/56350 | | 7 | + description: Type stripping is enabled by default. | 5 | 8 | - version: v22.7.0 | 6 | 9 | pr-url: https://github.com/nodejs/node/pull/54283 | 7 | 10 | description: Added `--experimental-transform-types` flag. | @@ -52,7 +55,7 @@ added: v22.6.0 | 52 | 55 |
| 53 | 56 | > Stability: 1.1 - Active development | 54 | 57 |
| 55 | | -The flag [`--experimental-strip-types`][] enables Node.js to run TypeScript | | 58 | +The flag [`--no-experimental-strip-types`][] prevents Node.js from running TypeScript | 56 | 59 | files. By default Node.js will execute only files that contain no | 57 | 60 | TypeScript features that require transformation, such as enums or namespaces. | 58 | 61 | Node.js will replace inline type annotations with whitespace, | @@ -181,8 +184,8 @@ with `#`. | 181 | 184 | [CommonJS]: modules.md | 182 | 185 | [ES Modules]: esm.md | 183 | 186 | [Full TypeScript support]: #full-typescript-support | 184 | | -[`--experimental-strip-types`]: cli.md#--experimental-strip-types | 185 | 187 | [`--experimental-transform-types`]: cli.md#--experimental-transform-types | | 188 | +[`--no-experimental-strip-types`]: cli.md#--no-experimental-strip-types | 186 | 189 | [`tsconfig` "paths"]: https://www.typescriptlang.org/tsconfig/#paths | 187 | 190 | [`tsx`]: https://tsx.is/ | 188 | 191 | [`verbatimModuleSyntax`]: https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax | |
Collapse file Copy file name to clipboardExpand all lines: doc/node.1 +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -186,9 +186,6 @@ Enable code coverage in the test runner. | 186 | 186 | .It Fl -experimental-test-module-mocks | 187 | 187 | Enable module mocking in the test runner. | 188 | 188 | . | 189 | | -.It Fl -experimental-strip-types | 190 | | -Enable experimental type-stripping for TypeScript files. | 191 | | -. | 192 | 189 | .It Fl -experimental-transform-types | 193 | 190 | Enable transformation of TypeScript-only syntax into JavaScript code. | 194 | 191 | . | @@ -207,6 +204,9 @@ Disable top-level await keyword support in REPL. | 207 | 204 | .It Fl -no-experimental-sqlite | 208 | 205 | Disable the experimental node:sqlite module. | 209 | 206 | . | | 207 | +.It Fl -no-experimental-strip-types | | 208 | +Disable experimental type-stripping for TypeScript files. | | 209 | +. | 210 | 210 | .It Fl -experimental-vm-modules | 211 | 211 | Enable experimental ES module support in VM module. | 212 | 212 | . | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -856,7 +856,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | 856 | 856 | AddOption("--experimental-strip-types", | 857 | 857 | "Experimental type-stripping for TypeScript files.", | 858 | 858 | &EnvironmentOptions::experimental_strip_types, | 859 | | - kAllowedInEnvvar); | | 859 | + kAllowedInEnvvar, | | 860 | + true); | 860 | 861 | AddOption("--experimental-transform-types", | 861 | 862 | "enable transformation of TypeScript-only" | 862 | 863 | "syntax into JavaScript code", | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -247,7 +247,7 @@ class EnvironmentOptions : public Options { | 247 | 247 |
| 248 | 248 | std::vector<std::string> preload_esm_modules; | 249 | 249 |
| 250 | | - bool experimental_strip_types = false; | | 250 | + bool experimental_strip_types = true; | 251 | 251 | bool experimental_transform_types = false; | 252 | 252 |
| 253 | 253 | std::vector<std::string> user_argv; | |
Collapse file Copy file name to clipboardExpand all lines: test/es-module/test-esm-loader-entry-url.mjs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -84,7 +84,7 @@ describe('--entry-url', { concurrency: true }, () => { | 84 | 84 |
| 85 | 85 | for (const url of typescriptUrls) { | 86 | 86 | await assertSpawnedProcess( | 87 | | - ['--entry-url', '--experimental-strip-types', fixtures.fileURL(url)], | | 87 | + ['--entry-url', fixtures.fileURL(url)], | 88 | 88 | {}, | 89 | 89 | { | 90 | 90 | ...experimentalFeatureWarning, | |
Collapse file Copy file name to clipboardExpand all lines: test/es-module/test-esm-resolve-type.mjs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -186,7 +186,7 @@ try { | 186 | 186 | [ 'qmod', 'index.js', 'imp.js', 'commonjs', 'module', 'module', '?k=v'], | 187 | 187 | [ 'hmod', 'index.js', 'imp.js', 'commonjs', 'module', 'module', '#Key'], | 188 | 188 | [ 'qhmod', 'index.js', 'imp.js', 'commonjs', 'module', 'module', '?k=v#h'], | 189 | | - [ 'ts-mod-com', 'index.js', 'imp.ts', 'module', 'commonjs', undefined], | | 189 | + [ 'ts-mod-com', 'index.js', 'imp.ts', 'module', 'commonjs', 'commonjs-typescript'], | 190 | 190 | ].forEach((testVariant) => { | 191 | 191 | const [ | 192 | 192 | moduleName, | |
|