Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure reexports are available for namespaces (#4499)
- Loading branch information
1 parent
0537d93
commit 05d294f
Showing
20 changed files
with
191 additions
and
6 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
9 changes: 9 additions & 0 deletions
9
test/function/samples/dynamic-imports-shared-exports/_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,9 @@ | ||
module.exports = { | ||
description: 'allows sharing imports between dynamic chunks', | ||
options: { | ||
preserveEntrySignatures: 'allow-extension' | ||
}, | ||
exports(exports) { | ||
return exports.promise; | ||
} | ||
}; |
16 changes: 16 additions & 0 deletions
16
test/function/samples/dynamic-imports-shared-exports/_expected/amd/generated-dynamic1.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 @@ | ||
define(['require', 'exports', './main'], (function (require, exports, main) { 'use strict'; | ||
|
||
const sharedDynamic = true; | ||
|
||
new Promise(function (resolve, reject) { require(['./generated-dynamic2'], resolve, reject); }); | ||
console.log(sharedDynamic); | ||
|
||
var dynamic1 = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
shared: main.shared | ||
}); | ||
|
||
exports.dynamic1 = dynamic1; | ||
exports.sharedDynamic = sharedDynamic; | ||
|
||
})); |
5 changes: 5 additions & 0 deletions
5
test/function/samples/dynamic-imports-shared-exports/_expected/amd/generated-dynamic2.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 @@ | ||
define(['./generated-dynamic1', './main'], (function (dynamic1, main) { 'use strict'; | ||
|
||
console.log(dynamic1.sharedDynamic); | ||
|
||
})); |
12 changes: 12 additions & 0 deletions
12
test/function/samples/dynamic-imports-shared-exports/_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,12 @@ | ||
define(['require', 'exports'], (function (require, exports) { 'use strict'; | ||
|
||
const shared = true; | ||
|
||
new Promise(function (resolve, reject) { require(['./generated-dynamic1'], resolve, reject); }).then(function (n) { return n.dynamic1; }); | ||
console.log(shared); | ||
|
||
exports.shared = shared; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
})); |
16 changes: 16 additions & 0 deletions
16
test/function/samples/dynamic-imports-shared-exports/_expected/cjs/generated-dynamic1.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 @@ | ||
'use strict'; | ||
|
||
var main = require('./main.js'); | ||
|
||
const sharedDynamic = true; | ||
|
||
Promise.resolve().then(function () { return require('./generated-dynamic2.js'); }); | ||
console.log(sharedDynamic); | ||
|
||
var dynamic1 = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
shared: main.shared | ||
}); | ||
|
||
exports.dynamic1 = dynamic1; | ||
exports.sharedDynamic = sharedDynamic; |
6 changes: 6 additions & 0 deletions
6
test/function/samples/dynamic-imports-shared-exports/_expected/cjs/generated-dynamic2.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'; | ||
|
||
var dynamic1 = require('./generated-dynamic1.js'); | ||
require('./main.js'); | ||
|
||
console.log(dynamic1.sharedDynamic); |
10 changes: 10 additions & 0 deletions
10
test/function/samples/dynamic-imports-shared-exports/_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,10 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
const shared = true; | ||
|
||
Promise.resolve().then(function () { return require('./generated-dynamic1.js'); }).then(function (n) { return n.dynamic1; }); | ||
console.log(shared); | ||
|
||
exports.shared = shared; |
13 changes: 13 additions & 0 deletions
13
test/function/samples/dynamic-imports-shared-exports/_expected/es/generated-dynamic1.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 @@ | ||
import { s as shared } from './main.js'; | ||
|
||
const sharedDynamic = true; | ||
|
||
import('./generated-dynamic2.js'); | ||
console.log(sharedDynamic); | ||
|
||
var dynamic1 = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
shared: shared | ||
}); | ||
|
||
export { dynamic1 as d, sharedDynamic as s }; |
4 changes: 4 additions & 0 deletions
4
test/function/samples/dynamic-imports-shared-exports/_expected/es/generated-dynamic2.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 @@ | ||
import { s as sharedDynamic } from './generated-dynamic1.js'; | ||
import './main.js'; | ||
|
||
console.log(sharedDynamic); |
6 changes: 6 additions & 0 deletions
6
test/function/samples/dynamic-imports-shared-exports/_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,6 @@ | ||
const shared = true; | ||
|
||
import('./generated-dynamic1.js').then(function (n) { return n.d; }); | ||
console.log(shared); | ||
|
||
export { shared as s }; |
23 changes: 23 additions & 0 deletions
23
test/function/samples/dynamic-imports-shared-exports/_expected/system/generated-dynamic1.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,23 @@ | ||
System.register(['./main.js'], (function (exports, module) { | ||
'use strict'; | ||
var shared; | ||
return { | ||
setters: [function (module) { | ||
shared = module.s; | ||
}], | ||
execute: (function () { | ||
|
||
const sharedDynamic = exports('s', true); | ||
|
||
module.import('./generated-dynamic2.js'); | ||
console.log(sharedDynamic); | ||
|
||
var dynamic1 = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
shared: shared | ||
}); | ||
exports('d', dynamic1); | ||
|
||
}) | ||
}; | ||
})); |
14 changes: 14 additions & 0 deletions
14
test/function/samples/dynamic-imports-shared-exports/_expected/system/generated-dynamic2.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,14 @@ | ||
System.register(['./generated-dynamic1.js', './main.js'], (function () { | ||
'use strict'; | ||
var sharedDynamic; | ||
return { | ||
setters: [function (module) { | ||
sharedDynamic = module.s; | ||
}, function () {}], | ||
execute: (function () { | ||
|
||
console.log(sharedDynamic); | ||
|
||
}) | ||
}; | ||
})); |
13 changes: 13 additions & 0 deletions
13
test/function/samples/dynamic-imports-shared-exports/_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([], (function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: (function () { | ||
|
||
const shared = exports('s', true); | ||
|
||
module.import('./generated-dynamic1.js').then(function (n) { return n.d; }); | ||
console.log(shared); | ||
|
||
}) | ||
}; | ||
})); |
8 changes: 8 additions & 0 deletions
8
test/function/samples/dynamic-imports-shared-exports/dynamic1.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 @@ | ||
import { sharedDynamic } from './sharedDynamic.js'; | ||
|
||
assert.ok(sharedDynamic); | ||
export const promise = import('./dynamic2.js').then(ns => | ||
assert.deepStrictEqual(ns, { sharedDynamic: true }) | ||
); | ||
|
||
export { shared } from './shared.js'; |
1 change: 1 addition & 0 deletions
1
test/function/samples/dynamic-imports-shared-exports/dynamic2.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 { sharedDynamic } from './sharedDynamic.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 @@ | ||
import { shared } from './shared.js'; | ||
|
||
assert.ok(shared); | ||
export const promise = import('./dynamic1.js').then(({ promise, ...ns }) => { | ||
assert.deepStrictEqual(ns, { shared: true }); | ||
return ns.promise; | ||
}); |
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 shared = true; |
1 change: 1 addition & 0 deletions
1
test/function/samples/dynamic-imports-shared-exports/sharedDynamic.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 sharedDynamic = true; |