Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use correct import.meta.url slashes on Windows (#4693)
* Test for wrong import-meta slashes * Use forward slashes in preserveModules chunk ids * Ensure ids in import.meta are always properly escaped * Fix tests on Node 18 * Allow Github install without git
- Loading branch information
1 parent
f518bec
commit bac9826
Showing
20 changed files
with
92 additions
and
7 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
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/import-meta-numeric-paths/0/1/nested.js
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 @@ | ||
export const url = import.meta.url; |
16 changes: 16 additions & 0 deletions
16
test/chunking-form/samples/import-meta-numeric-paths/_config.js
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,16 @@ | ||
const assert = require('node:assert'); | ||
|
||
module.exports = { | ||
description: 'supports nested numeric paths without issues on Windows', | ||
options: { | ||
output: { preserveModules: true }, | ||
plugins: [ | ||
{ | ||
name: 'test', | ||
generateBundle(options, bundle) { | ||
assert.deepStrictEqual(Object.keys(bundle), ['main.js', '0/1/nested.js']); | ||
} | ||
} | ||
] | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/0/1/nested.js
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,7 @@ | ||
define(['module', 'exports'], (function (module, exports) { 'use strict'; | ||
|
||
const url = new URL(module.uri, document.baseURI).href; | ||
|
||
exports.url = url; | ||
|
||
})); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/main.js
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,7 @@ | ||
define(['exports', './0/1/nested'], (function (exports, nested) { 'use strict'; | ||
|
||
|
||
|
||
exports.url = nested.url; | ||
|
||
})); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js
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,5 @@ | ||
'use strict'; | ||
|
||
const url = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('0/1/nested.js', document.baseURI).href)); | ||
|
||
exports.url = url; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/main.js
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,7 @@ | ||
'use strict'; | ||
|
||
var nested = require('./0/1/nested.js'); | ||
|
||
|
||
|
||
exports.url = nested.url; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/import-meta-numeric-paths/_expected/es/0/1/nested.js
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,3 @@ | ||
const url = import.meta.url; | ||
|
||
export { url }; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/import-meta-numeric-paths/_expected/es/main.js
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 @@ | ||
export { url } from './0/1/nested.js'; |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/import-meta-numeric-paths/_expected/system/0/1/nested.js
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,10 @@ | ||
System.register([], (function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: (function () { | ||
|
||
const url = exports('url', module.meta.url); | ||
|
||
}) | ||
}; | ||
})); |
13 changes: 13 additions & 0 deletions
13
test/chunking-form/samples/import-meta-numeric-paths/_expected/system/main.js
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,13 @@ | ||
System.register(['./0/1/nested.js'], (function (exports) { | ||
'use strict'; | ||
return { | ||
setters: [function (module) { | ||
exports('url', module.url); | ||
}], | ||
execute: (function () { | ||
|
||
|
||
|
||
}) | ||
}; | ||
})); |
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 @@ | ||
export { url } from './0/1/nested.js'; |
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