Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include extensions in preserveModules output filenames for scriptifie…
…d assets (#3116) * Include extensions in preserveModules output filenames for scriptified assets * Update documentation
- Loading branch information
1 parent
55dddd8
commit 998ddf1
Showing
49 changed files
with
232 additions
and
35 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
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
...king-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.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,12 @@ | ||
define(['exports', './entry-foo-amd-ts.ts', './nested/entry-bar-amd-ts.ts', './nested/entry-baz-amd-ts.ts', './entry-no-ext-amd-'], function (exports, foo, bar, baz, noExt) { 'use strict'; | ||
|
||
|
||
|
||
exports.foo = foo.default; | ||
exports.bar = bar.default; | ||
exports.baz = baz.default; | ||
exports.noExt = noExt.default; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
11 changes: 0 additions & 11 deletions
11
test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-main-amd.js
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...hunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-no-ext-amd-.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'], function (exports) { 'use strict'; | ||
|
||
var noExt = 'no-ext'; | ||
|
||
exports.default = noExt; | ||
|
||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...king-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.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,15 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var foo = require('./entry-foo-cjs-ts.ts.js'); | ||
var bar = require('./nested/entry-bar-cjs-ts.ts.js'); | ||
var baz = require('./nested/entry-baz-cjs-ts.ts.js'); | ||
var noExt = require('./entry-no-ext-cjs-.js'); | ||
|
||
|
||
|
||
exports.foo = foo.default; | ||
exports.bar = bar.default; | ||
exports.baz = baz.default; | ||
exports.noExt = noExt.default; |
13 changes: 0 additions & 13 deletions
13
test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs.js
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...hunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-no-ext-cjs-.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 noExt = 'no-ext'; | ||
|
||
exports.default = noExt; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...nking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-main-esm-ts.ts.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,4 @@ | ||
export { default as foo } from './entry-foo-esm-ts.ts.js'; | ||
export { default as bar } from './nested/entry-bar-esm-ts.ts.js'; | ||
export { default as baz } from './nested/entry-baz-esm-ts.ts.js'; | ||
export { default as noExt } from './entry-no-ext-esm-.js'; |
3 changes: 0 additions & 3 deletions
3
test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-main-esm.js
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-no-ext-esm-.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 noExt = 'no-ext'; | ||
|
||
export default noExt; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
10 changes: 10 additions & 0 deletions
10
...g-form/samples/preserve-modules-filename-pattern/_expected/system/entry-no-ext-system-.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) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var noExt = exports('default', 'no-ext'); | ||
|
||
} | ||
}; | ||
}); |
File renamed without changes.
File renamed without changes.
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/preserve-modules-filename-pattern/src/no-ext
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 default 'no-ext' |
26 changes: 26 additions & 0 deletions
26
test/chunking-form/samples/preserve-modules-scriptified-assets/_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,26 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
description: 'scriptified assets have extension in preserveModules output filename', | ||
options: { | ||
input: 'src/main.js', | ||
preserveModules: true, | ||
plugins: [ | ||
{ | ||
name: 'str-num-plugin', | ||
transform(code, id) { | ||
switch (path.extname(id)) { | ||
case '.num': | ||
return { code: `export default ${code.trim()}` }; | ||
case '.str': | ||
return { code: `export default "${code.trim()}"` }; | ||
case '': | ||
return { code: 'export default "COULDN\'T TRANSFORM"' }; | ||
default: | ||
return null; | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/amd/answer.num.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'], function (exports) { 'use strict'; | ||
|
||
var answer = 42; | ||
|
||
exports.default = answer; | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/amd/lorem.str.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'], function (exports) { 'use strict'; | ||
|
||
var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; | ||
|
||
exports.default = lorem; | ||
|
||
}); |
11 changes: 11 additions & 0 deletions
11
test/chunking-form/samples/preserve-modules-scriptified-assets/_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,11 @@ | ||
define(['exports', './answer.num', './lorem.str', './no-ext'], function (exports, answer, lorem, noExt) { 'use strict'; | ||
|
||
|
||
|
||
exports.answer = answer.default; | ||
exports.lorem = lorem.default; | ||
exports.noExt = noExt.default; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/amd/no-ext.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'], function (exports) { 'use strict'; | ||
|
||
var noExt = "COULDN'T TRANSFORM"; | ||
|
||
exports.default = noExt; | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/cjs/answer.num.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 answer = 42; | ||
|
||
exports.default = answer; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/cjs/lorem.str.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 lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; | ||
|
||
exports.default = lorem; |
13 changes: 13 additions & 0 deletions
13
test/chunking-form/samples/preserve-modules-scriptified-assets/_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,13 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var answer = require('./answer.num.js'); | ||
var lorem = require('./lorem.str.js'); | ||
var noExt = require('./no-ext.js'); | ||
|
||
|
||
|
||
exports.answer = answer.default; | ||
exports.lorem = lorem.default; | ||
exports.noExt = noExt.default; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/cjs/no-ext.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 noExt = "COULDN'T TRANSFORM"; | ||
|
||
exports.default = noExt; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/es/answer.num.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 answer = 42; | ||
|
||
export default answer; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/es/lorem.str.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-scriptified-assets/_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,3 @@ | ||
export { default as answer } from './answer.num.js'; | ||
export { default as lorem } from './lorem.str.js'; | ||
export { default as noExt } from './no-ext.js'; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/es/no-ext.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 noExt = "COULDN'T TRANSFORM"; | ||
|
||
export default noExt; |
10 changes: 10 additions & 0 deletions
10
.../chunking-form/samples/preserve-modules-scriptified-assets/_expected/system/answer.num.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) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var answer = exports('default', 42); | ||
|
||
} | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/system/lorem.str.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) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var lorem = exports('default', "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); | ||
|
||
} | ||
}; | ||
}); |
17 changes: 17 additions & 0 deletions
17
test/chunking-form/samples/preserve-modules-scriptified-assets/_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,17 @@ | ||
System.register(['./answer.num.js', './lorem.str.js', './no-ext.js'], function (exports) { | ||
'use strict'; | ||
return { | ||
setters: [function (module) { | ||
exports('answer', module.default); | ||
}, function (module) { | ||
exports('lorem', module.default); | ||
}, function (module) { | ||
exports('noExt', module.default); | ||
}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/preserve-modules-scriptified-assets/_expected/system/no-ext.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) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var noExt = exports('default', "COULDN'T TRANSFORM"); | ||
|
||
} | ||
}; | ||
}); |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/preserve-modules-scriptified-assets/src/answer.num
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 @@ | ||
42 |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/preserve-modules-scriptified-assets/src/lorem.str
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 @@ | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-scriptified-assets/src/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,3 @@ | ||
export { default as answer } from './answer.num'; | ||
export { default as lorem } from './lorem.str'; | ||
export { default as noExt } from './no-ext'; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/preserve-modules-scriptified-assets/src/no-ext
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 @@ | ||
WHATEVER |