-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include extensions in preserveModules output filenames for scriptified assets #3116
Merged
lukastaegert
merged 2 commits into
rollup:master
from
Andarist:preserve-modules/scriptified-assets-ext-in-filenames
Oct 3, 2019
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to also have a test that directly uses the new pattern elements in
entryFileNames
. Could also be an extension of an existing test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, gonna tweak it.