-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: import.meta.resolve with nodejs: builtins
PR-URL: #31032 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
- Loading branch information
1 parent
8d3ffbe
commit f6392e9
Showing
15 changed files
with
141 additions
and
37 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
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,24 @@ | ||
// Flags: --experimental-import-meta-resolve | ||
import '../common/index.mjs'; | ||
import assert from 'assert'; | ||
|
||
const dirname = import.meta.url.slice(0, import.meta.url.lastIndexOf('/') + 1); | ||
const fixtures = dirname.slice(0, dirname.lastIndexOf('/', dirname.length - 2) + | ||
1) + 'fixtures/'; | ||
|
||
(async () => { | ||
assert.strictEqual(await import.meta.resolve('./test-esm-import-meta.mjs'), | ||
dirname + 'test-esm-import-meta.mjs'); | ||
try { | ||
await import.meta.resolve('./notfound.mjs'); | ||
assert.fail(); | ||
} catch (e) { | ||
assert.strictEqual(e.code, 'ERR_MODULE_NOT_FOUND'); | ||
} | ||
assert.strictEqual( | ||
await import.meta.resolve('../fixtures/empty-with-bom.txt'), | ||
fixtures + 'empty-with-bom.txt'); | ||
assert.strictEqual(await import.meta.resolve('../fixtures/'), fixtures); | ||
assert.strictEqual(await import.meta.resolve('baz/', fixtures), | ||
fixtures + 'node_modules/baz/'); | ||
})(); |
Oops, something went wrong.