-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: make specifier flag clearly experimental
`--es-module-specifier-resolution` is the only flagged portion of the ESM implementation that does not have the word experimental in the flag name. This commit changes the flag to: `--experimental-specifier-resolution` `--es-module-specifier-resolution` remains as an alias for backwards compatibility but it is no longer documented. PR-URL: #30678 Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
- Loading branch information
1 parent
d7972b7
commit 0a4cfef
Showing
11 changed files
with
95 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Flags: --experimental-modules | ||
import { mustCall } from '../common/index.mjs'; | ||
import { exec } from 'child_process'; | ||
import assert from 'assert'; | ||
|
||
const expectedError = | ||
'cannot use --es-module-specifier-resolution ' + | ||
'and --experimental-specifier-resolution at the same time'; | ||
|
||
const flags = '--experimental-modules ' + | ||
'--es-module-specifier-resolution=node ' + | ||
'--experimental-specifier-resolution=node'; | ||
|
||
exec(`${process.execPath} ${flags}`, { | ||
timeout: 300 | ||
}, mustCall((error) => { | ||
assert(error.message.includes(expectedError)); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Flags: --experimental-modules --es-module-specifier-resolution=node | ||
import '../common/index.mjs'; | ||
import assert from 'assert'; | ||
|
||
// commonJS index.js | ||
import commonjs from '../fixtures/es-module-specifiers/package-type-commonjs'; | ||
// esm index.js | ||
import module from '../fixtures/es-module-specifiers/package-type-module'; | ||
// Notice the trailing slash | ||
import success, { explicit, implicit, implicitModule } | ||
from '../fixtures/es-module-specifiers/'; | ||
|
||
assert.strictEqual(commonjs, 'commonjs'); | ||
assert.strictEqual(module, 'module'); | ||
assert.strictEqual(success, 'success'); | ||
assert.strictEqual(explicit, 'esm'); | ||
assert.strictEqual(implicit, 'cjs'); | ||
assert.strictEqual(implicitModule, 'cjs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters