-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: runtime deprecate subpath folder mappings
PR-URL: #35747 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
- Loading branch information
1 parent
d95013f
commit 0f5a8c5
Showing
7 changed files
with
171 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Flags: --pending-deprecation | ||
import { mustCall } from '../common/index.mjs'; | ||
import assert from 'assert'; | ||
|
||
let curWarning = 0; | ||
const expectedWarnings = [ | ||
'"./sub/"', | ||
'"./fallbackdir/"', | ||
'"./subpath/"' | ||
]; | ||
|
||
process.addListener('warning', mustCall((warning) => { | ||
assert(warning.stack.includes(expectedWarnings[curWarning++]), warning.stack); | ||
}, expectedWarnings.length)); | ||
|
||
(async () => { | ||
await import('./test-esm-exports.mjs'); | ||
})() | ||
.catch((err) => console.error(err)); |
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,22 @@ | ||
import { mustCall } from '../common/index.mjs'; | ||
import assert from 'assert'; | ||
import fixtures from '../common/fixtures.js'; | ||
import { pathToFileURL } from 'url'; | ||
|
||
const selfDeprecatedFolders = | ||
fixtures.path('/es-modules/self-deprecated-folders/main.js'); | ||
|
||
let curWarning = 0; | ||
const expectedWarnings = [ | ||
'"./" in the "exports" field', | ||
'"#self/" in the "imports" field' | ||
]; | ||
|
||
process.addListener('warning', mustCall((warning) => { | ||
assert(warning.stack.includes(expectedWarnings[curWarning++]), warning.stack); | ||
}, expectedWarnings.length)); | ||
|
||
(async () => { | ||
await import(pathToFileURL(selfDeprecatedFolders)); | ||
})() | ||
.catch((err) => console.error(err)); |
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,2 @@ | ||
import 'self/main.js'; | ||
import '#self/main.js'; |
11 changes: 11 additions & 0 deletions
11
test/fixtures/es-modules/self-deprecated-folders/package.json
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,11 @@ | ||
{ | ||
"name": "self", | ||
"type": "module", | ||
"exports": { | ||
".": "./main.js", | ||
"./": "./" | ||
}, | ||
"imports": { | ||
"#self/": "./" | ||
} | ||
} |