Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sanitizes chunk names to allow for virtually created chunks (#2590)
- Loading branch information
1 parent
ed67b63
commit 551654c
Showing
13 changed files
with
80 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function sanitizeFileName(name: string): string { | ||
return name.replace(/[\0]/g, '_'); | ||
} |
20 changes: 20 additions & 0 deletions
20
test/chunking-form/samples/sanitize-chunk-names/_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,20 @@ | ||
module.exports = { | ||
description: 'sanitizes chunk names from virtual entry points', | ||
options: { | ||
input: ['main1'], | ||
plugins: [ | ||
{ | ||
options(options) { | ||
options.input = ['\0virtual:entry-1', '\0virtual:entry-2']; | ||
return options; | ||
}, | ||
resolveId(id) { | ||
return id; | ||
}, | ||
load(id) { | ||
return 'export default ' + JSON.stringify(id); | ||
} | ||
} | ||
] | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/sanitize-chunk-names/_expected/amd/_virtual:entry-1.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(function () { 'use strict'; | ||
|
||
var _virtual_entry1 = "\u0000virtual:entry-1"; | ||
|
||
return _virtual_entry1; | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/sanitize-chunk-names/_expected/amd/_virtual:entry-2.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(function () { 'use strict'; | ||
|
||
var _virtual_entry2 = "\u0000virtual:entry-2"; | ||
|
||
return _virtual_entry2; | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/sanitize-chunk-names/_expected/cjs/_virtual:entry-1.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'; | ||
|
||
var _virtual_entry1 = "\u0000virtual:entry-1"; | ||
|
||
module.exports = _virtual_entry1; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/sanitize-chunk-names/_expected/cjs/_virtual:entry-2.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'; | ||
|
||
var _virtual_entry2 = "\u0000virtual:entry-2"; | ||
|
||
module.exports = _virtual_entry2; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/sanitize-chunk-names/_expected/es/_virtual:entry-1.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 @@ | ||
var _virtual_entry1 = "\u0000virtual:entry-1"; | ||
|
||
export default _virtual_entry1; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/sanitize-chunk-names/_expected/es/_virtual:entry-2.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 @@ | ||
var _virtual_entry2 = "\u0000virtual:entry-2"; | ||
|
||
export default _virtual_entry2; |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/sanitize-chunk-names/_expected/system/_virtual:entry-1.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 () { | ||
|
||
var _virtual_entry1 = exports('default', "\u0000virtual:entry-1"); | ||
|
||
} | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/sanitize-chunk-names/_expected/system/_virtual:entry-2.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 () { | ||
|
||
var _virtual_entry2 = exports('default', "\u0000virtual:entry-2"); | ||
|
||
} | ||
}; | ||
}); |
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 @@ | ||
console.log('main1'); |