-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate namespace inclusion tracking per output, handle dynamic impo…
…rts of synthetic namespace modules
- Loading branch information
1 parent
d917447
commit 2a1f487
Showing
18 changed files
with
132 additions
and
42 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
18 changes: 18 additions & 0 deletions
18
test/chunking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_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,18 @@ | ||
module.exports = { | ||
description: | ||
'handle dynamically importing a module with synthetic named exports when preserving modules', | ||
options: { | ||
input: ['main', 'lib'], | ||
plugins: { | ||
name: 'test-plugin', | ||
transform(code, id) { | ||
if (id.endsWith('lib.js')) { | ||
return { code, syntheticNamedExports: '__moduleExports' }; | ||
} | ||
} | ||
}, | ||
output: { | ||
preserveModules: true | ||
} | ||
} | ||
}; |
8 changes: 8 additions & 0 deletions
8
...nking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_expected/amd/lib.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,8 @@ | ||
define(function () { 'use strict'; | ||
|
||
const __moduleExports = { foo: 'bar' }; | ||
var lib = 'baz'; | ||
|
||
return lib; | ||
|
||
}); |
9 changes: 9 additions & 0 deletions
9
...king-form/samples/dynamic-import-synthetic-exports-preserve-modules/_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,9 @@ | ||
define(['require'], function (require) { 'use strict'; | ||
|
||
function _interopNamespaceDefaultOnly(e) { | ||
return Object.freeze({__proto__: null, 'default': e}); | ||
} | ||
|
||
new Promise(function (resolve, reject) { require(['./lib'], function (m) { resolve(/*#__PURE__*/_interopNamespaceDefaultOnly(m)); }, reject) }).then(console.log); | ||
|
||
}); |
6 changes: 6 additions & 0 deletions
6
...nking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_expected/cjs/lib.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,6 @@ | ||
'use strict'; | ||
|
||
const __moduleExports = { foo: 'bar' }; | ||
var lib = 'baz'; | ||
|
||
module.exports = lib; |
7 changes: 7 additions & 0 deletions
7
...king-form/samples/dynamic-import-synthetic-exports-preserve-modules/_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'; | ||
|
||
function _interopNamespaceDefaultOnly(e) { | ||
return Object.freeze({__proto__: null, 'default': e}); | ||
} | ||
|
||
Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./lib.js')); }).then(console.log); |
4 changes: 4 additions & 0 deletions
4
...unking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_expected/es/lib.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 @@ | ||
const __moduleExports = { foo: 'bar' }; | ||
var lib = 'baz'; | ||
|
||
export default lib; |
1 change: 1 addition & 0 deletions
1
...nking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_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 @@ | ||
import('./lib.js').then(console.log); |
11 changes: 11 additions & 0 deletions
11
...ng-form/samples/dynamic-import-synthetic-exports-preserve-modules/_expected/system/lib.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 @@ | ||
System.register([], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const __moduleExports = { foo: 'bar' }; | ||
var lib = exports('default', 'baz'); | ||
|
||
} | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
...g-form/samples/dynamic-import-synthetic-exports-preserve-modules/_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,10 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
module.import('./lib.js').then(console.log); | ||
|
||
} | ||
}; | ||
}); |
2 changes: 2 additions & 0 deletions
2
test/chunking-form/samples/dynamic-import-synthetic-exports-preserve-modules/lib.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,2 @@ | ||
export const __moduleExports = { foo: 'bar' }; | ||
export default 'baz'; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/dynamic-import-synthetic-exports-preserve-modules/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 @@ | ||
import('./lib.js').then(console.log); |