| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2e39f3e commit 8f6fada
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1225,27 +1225,6 @@ added: v25.0.0 | |||
| 1225 | 1225 | ||
| 1226 | 1226 | Enable experimental support for the QUIC protocol. | |
| 1227 | 1227 | ||
| 1228 | - ### `--experimental-require-module` | ||
| 1229 | - | ||
| 1230 | - <!-- YAML | ||
| 1231 | - added: | ||
| 1232 | - - v22.0.0 | ||
| 1233 | - - v20.17.0 | ||
| 1234 | - changes: | ||
| 1235 | - - version: | ||
| 1236 | - - v23.0.0 | ||
| 1237 | - - v22.12.0 | ||
| 1238 | - - v20.19.0 | ||
| 1239 | - pr-url: https://github.com/nodejs/node/pull/55085 | ||
| 1240 | - description: This is now true by default. | ||
| 1241 | - --> | ||
| 1242 | - | ||
| 1243 | - > Stability: 1.1 - Active Development | ||
| 1244 | - | ||
| 1245 | - Supports loading a synchronous ES module graph in `require()`. | ||
| 1246 | - | ||
| 1247 | - See [Loading ECMAScript modules using `require()`][]. | ||
| 1248 | - | ||
| 1249 | 1228 | ### `--experimental-sea-config` | |
| 1250 | 1229 | ||
| 1251 | 1230 | <!-- YAML | |
@@ -1920,6 +1899,11 @@ added: | |||
| 1920 | 1899 | - v22.0.0 | |
| 1921 | 1900 | - v20.17.0 | |
| 1922 | 1901 | changes: | |
| 1902 | + - version: | ||
| 1903 | + - REPLACEME | ||
| 1904 | + pr-url: https://github.com/nodejs/node/pull/60959 | ||
| 1905 | + description: The flag was renamed from `--no-experimental-require-module` to | ||
| 1906 | + `--no-require-module`, with the former marked as legacy. | ||
| 1923 | 1907 | - version: | |
| 1924 | 1908 | - v23.0.0 | |
| 1925 | 1909 | - v22.12.0 | |
@@ -1928,11 +1912,9 @@ changes: | |||
| 1928 | 1912 | description: This is now false by default. | |
| 1929 | 1913 | --> | |
| 1930 | 1914 | ||
| 1931 | - > Stability: 1.1 - Active Development | ||
| 1932 | - | ||
| 1933 | - Disable support for loading a synchronous ES module graph in `require()`. | ||
| 1915 | + > Stability: 3 - Legacy: Use [`--no-require-module`][] instead. | ||
| 1934 | 1916 | ||
| 1935 | - See [Loading ECMAScript modules using `require()`][]. | ||
| 1917 | + Legacy alias for [`--no-require-module`][]. | ||
| 1936 | 1918 | ||
| 1937 | 1919 | ### `--no-experimental-sqlite` | |
| 1938 | 1920 | ||
@@ -2011,6 +1993,34 @@ changes: | |||
| 2011 | 1993 | Disables the family autoselection algorithm unless connection options explicitly | |
| 2012 | 1994 | enables it. | |
| 2013 | 1995 | ||
| 1996 | + <a id="--experimental-require-module"></a> | ||
| 1997 | + | ||
| 1998 | + ### `--no-require-module` | ||
| 1999 | + | ||
| 2000 | + <!-- YAML | ||
| 2001 | + added: | ||
| 2002 | + - v22.0.0 | ||
| 2003 | + - v20.17.0 | ||
| 2004 | + changes: | ||
| 2005 | + - version: | ||
| 2006 | + - REPLACEME | ||
| 2007 | + pr-url: https://github.com/nodejs/node/pull/60959 | ||
| 2008 | + description: This flag was renamed from `--no-experimental-require-module` | ||
| 2009 | + to `--no-require-module`. | ||
| 2010 | + - version: | ||
| 2011 | + - v23.0.0 | ||
| 2012 | + - v22.12.0 | ||
| 2013 | + - v20.19.0 | ||
| 2014 | + pr-url: https://github.com/nodejs/node/pull/55085 | ||
| 2015 | + description: This is now false by default. | ||
| 2016 | + --> | ||
| 2017 | + | ||
| 2018 | + > Stability: 1.2 - Release Candidate | ||
| 2019 | + | ||
| 2020 | + Disable support for loading a synchronous ES module graph in `require()`. | ||
| 2021 | + | ||
| 2022 | + See [Loading ECMAScript modules using `require()`][]. | ||
| 2023 | + | ||
| 2014 | 2024 | ### `--no-strip-types` | |
| 2015 | 2025 | ||
| 2016 | 2026 | <!-- YAML | |
@@ -3624,6 +3634,7 @@ one is included in the list below. | |||
| 3624 | 3634 | * `--report-on-signal` | |
| 3625 | 3635 | * `--report-signal` | |
| 3626 | 3636 | * `--report-uncaught-exception` | |
| 3637 | + * `--require-module` | ||
| 3627 | 3638 | * `--require`, `-r` | |
| 3628 | 3639 | * `--secure-heap-min` | |
| 3629 | 3640 | * `--secure-heap` | |
@@ -4164,6 +4175,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | |||
| 4164 | 4175 | [`--experimental-sea-config`]: single-executable-applications.md#generating-single-executable-preparation-blobs | |
| 4165 | 4176 | [`--heap-prof-dir`]: #--heap-prof-dir | |
| 4166 | 4177 | [`--import`]: #--importmodule | |
| 4178 | + [`--no-require-module`]: #--no-require-module | ||
| 4167 | 4179 | [`--no-strip-types`]: #--no-strip-types | |
| 4168 | 4180 | [`--openssl-config`]: #--openssl-configfile | |
| 4169 | 4181 | [`--preserve-symlinks`]: #--preserve-symlinks | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -324,8 +324,8 @@ If `--experimental-print-required-tla` is enabled, instead of throwing | |||
| 324 | 324 | module, try to locate the top-level awaits, and print their location to | |
| 325 | 325 | help users fix them. | |
| 326 | 326 | ||
| 327 | - Support for loading ES modules using `require()` is currently | ||
| 328 | - experimental and can be disabled using `--no-experimental-require-module`. | ||
| 327 | + If support for loading ES modules using `require()` results in unexpected | ||
| 328 | + breakage, it can be disabled using `--no-require-module`. | ||
| 329 | 329 | To print where this feature is used, use [`--trace-require-module`][]. | |
| 330 | 330 | ||
| 331 | 331 | This feature can be detected by checking if | |
@@ -422,7 +422,7 @@ LOAD_PACKAGE_IMPORTS(X, DIR) | |||
| 422 | 422 | 1. Find the closest package scope SCOPE to DIR. | |
| 423 | 423 | 2. If no scope was found, return. | |
| 424 | 424 | 3. If the SCOPE/package.json "imports" is null or undefined, return. | |
| 425 | - 4. If `--experimental-require-module` is enabled | ||
| 425 | + 4. If `--no-require-module` is not enabled | ||
| 426 | 426 | a. let CONDITIONS = ["node", "require", "module-sync"] | |
| 427 | 427 | b. Else, let CONDITIONS = ["node", "require"] | |
| 428 | 428 | 5. let MATCH = PACKAGE_IMPORTS_RESOLVE(X, pathToFileURL(SCOPE), | |
@@ -436,7 +436,7 @@ LOAD_PACKAGE_EXPORTS(X, DIR) | |||
| 436 | 436 | return. | |
| 437 | 437 | 3. Parse DIR/NAME/package.json, and look for "exports" field. | |
| 438 | 438 | 4. If "exports" is null or undefined, return. | |
| 439 | - 5. If `--experimental-require-module` is enabled | ||
| 439 | + 5. If `--no-require-module` is not enabled | ||
| 440 | 440 | a. let CONDITIONS = ["node", "require", "module-sync"] | |
| 441 | 441 | b. Else, let CONDITIONS = ["node", "require"] | |
| 442 | 442 | 6. let MATCH = PACKAGE_EXPORTS_RESOLVE(pathToFileURL(DIR/NAME), "." + SUBPATH, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -216,6 +216,9 @@ Disable top-level await keyword support in REPL. | |||
| 216 | 216 | .It Fl -no-experimental-sqlite | |
| 217 | 217 | Disable the experimental node:sqlite module. | |
| 218 | 218 | . | |
| 219 | + .It Fl -no-require-module | ||
| 220 | + Disable support for loading ECMAScript modules with require(). | ||
| 221 | + . | ||
| 219 | 222 | .It Fl -no-strip-types | |
| 220 | 223 | Disable type-stripping for TypeScript files. | |
| 221 | 224 | . | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -283,7 +283,7 @@ const features = { | |||
| 283 | 283 | return binding.hasCachedBuiltins(); | |
| 284 | 284 | }, | |
| 285 | 285 | get require_module() { | |
| 286 | - return getOptionValue('--experimental-require-module'); | ||
| 286 | + return getOptionValue('--require-module'); | ||
| 287 | 287 | }, | |
| 288 | 288 | get quic() { | |
| 289 | 289 | // TODO(@jasnell): When the implementation is updated to support Boring, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1685,7 +1685,7 @@ function wrapSafe(filename, content, cjsModuleInstance, format) { | |||
| 1685 | 1685 | } else { | |
| 1686 | 1686 | // For modules being loaded by `require()`, if require(esm) is disabled, | |
| 1687 | 1687 | // don't try to reparse to detect format and just throw for ESM syntax. | |
| 1688 | - shouldDetectModule = getOptionValue('--experimental-require-module'); | ||
| 1688 | + shouldDetectModule = getOptionValue('--require-module'); | ||
| 1689 | 1689 | } | |
| 1690 | 1690 | } | |
| 1691 | 1691 | const result = compileFunctionForCJSLoader(content, filename, false /* is_sea_main */, shouldDetectModule); | |
@@ -1884,7 +1884,7 @@ Module._extensions['.js'] = function(module, filename) { | |||
| 1884 | 1884 | const { source, format: loadedFormat } = loadSource(module, filename, format); | |
| 1885 | 1885 | // Function require shouldn't be used in ES modules when require(esm) is disabled. | |
| 1886 | 1886 | if ((loadedFormat === 'module' || loadedFormat === 'module-typescript') && | |
| 1887 | - !getOptionValue('--experimental-require-module')) { | ||
| 1887 | + !getOptionValue('--require-module')) { | ||
| 1888 | 1888 | const err = getRequireESMError(module, pkg, source, filename); | |
| 1889 | 1889 | throw err; | |
| 1890 | 1890 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -299,7 +299,7 @@ class ModuleLoader { | |||
| 299 | 299 | */ | |
| 300 | 300 | importSyncForRequire(mod, filename, source, isMain, parent) { | |
| 301 | 301 | const url = pathToFileURL(filename).href; | |
| 302 | - if (!getOptionValue('--experimental-require-module')) { | ||
| 302 | + if (!getOptionValue('--require-module')) { | ||
| 303 | 303 | throw new ERR_REQUIRE_ESM(url, true); | |
| 304 | 304 | } | |
| 305 | 305 | ||
@@ -489,7 +489,7 @@ class ModuleLoader { | |||
| 489 | 489 | } | |
| 490 | 490 | ||
| 491 | 491 | if (formatFromLoad === 'module' || formatFromLoad === 'module-typescript') { | |
| 492 | - if (!getOptionValue('--experimental-require-module')) { | ||
| 492 | + if (!getOptionValue('--require-module')) { | ||
| 493 | 493 | throw new ERR_REQUIRE_ESM(url, true); | |
| 494 | 494 | } | |
| 495 | 495 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,7 +75,7 @@ function initializeDefaultConditions() { | |||
| 75 | 75 | const userConditions = getOptionValue('--conditions'); | |
| 76 | 76 | const noAddons = getOptionValue('--no-addons'); | |
| 77 | 77 | const addonConditions = noAddons ? [] : ['node-addons']; | |
| 78 | - const moduleConditions = getOptionValue('--experimental-require-module') ? ['module-sync'] : []; | ||
| 78 | + const moduleConditions = getOptionValue('--require-module') ? ['module-sync'] : []; | ||
| 79 | 79 | defaultConditions = ObjectFreeze([ | |
| 80 | 80 | 'node', | |
| 81 | 81 | 'import', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,7 +84,7 @@ function initializeCjsConditions() { | |||
| 84 | 84 | ...addonConditions, | |
| 85 | 85 | ...userConditions, | |
| 86 | 86 | ]; | |
| 87 | - if (getOptionValue('--experimental-require-module')) { | ||
| 87 | + if (getOptionValue('--require-module')) { | ||
| 88 | 88 | cjsConditionsArray.push('module-sync'); | |
| 89 | 89 | } | |
| 90 | 90 | ObjectFreeze(cjsConditionsArray); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -487,17 +487,23 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 487 | 487 | kAllowedInEnvvar, | |
| 488 | 488 | true); | |
| 489 | 489 | AddOption("--experimental-print-required-tla", | |
| 490 | - "Print pending top-level await. If --experimental-require-module " | ||
| 490 | + "Print pending top-level await. If --require-module " | ||
| 491 | 491 | "is true, evaluate asynchronous graphs loaded by `require()` but " | |
| 492 | 492 | "do not run the microtasks, in order to to find and print " | |
| 493 | 493 | "top-level await in the graph", | |
| 494 | 494 | &EnvironmentOptions::print_required_tla, | |
| 495 | 495 | kAllowedInEnvvar); | |
| 496 | - AddOption("--experimental-require-module", | ||
| 496 | + AddOption("--require-module", | ||
| 497 | 497 | "Allow loading synchronous ES Modules in require().", | |
| 498 | 498 | &EnvironmentOptions::require_module, | |
| 499 | 499 | kAllowedInEnvvar, | |
| 500 | 500 | true); | |
| 501 | + AddOption("--experimental-require-module", | ||
| 502 | + "Legacy alias for --require-module", | ||
| 503 | + &EnvironmentOptions::require_module, | ||
| 504 | + kAllowedInEnvvar, | ||
| 505 | + true); | ||
| 506 | + Implies("--experimental-require-module", "--require-module"); | ||
| 501 | 507 | AddOption("--diagnostic-dir", | |
| 502 | 508 | "set dir for all output files" | |
| 503 | 509 | " (default: current working directory)", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments