-
-
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.
Avoid variable name conflict when reexporting several namespaces from…
… a chunk (#3742)
- Loading branch information
1 parent
fada4f6
commit 9096087
Showing
22 changed files
with
189 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
6 changes: 6 additions & 0 deletions
6
test/chunking-form/samples/combined-namespace-reexport/_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,6 @@ | ||
module.exports = { | ||
description: 'correctly handles combined namespace reexports', | ||
options: { | ||
input: ['main1', 'main2'] | ||
} | ||
}; |
22 changes: 22 additions & 0 deletions
22
test/chunking-form/samples/combined-namespace-reexport/_expected/amd/generated-geometry.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,22 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
const foo = 'foo'; | ||
|
||
var volume = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
foo: foo | ||
}); | ||
|
||
const bar = 'bar'; | ||
|
||
var geometry = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
bar: bar | ||
}); | ||
|
||
exports.bar = bar; | ||
exports.foo = foo; | ||
exports.geometry = geometry; | ||
exports.volume = volume; | ||
|
||
}); |
11 changes: 11 additions & 0 deletions
11
test/chunking-form/samples/combined-namespace-reexport/_expected/amd/main1.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(['./generated-geometry'], function (geometry) { 'use strict'; | ||
|
||
var mod = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
volume: geometry.volume, | ||
geometry: geometry.geometry | ||
}); | ||
|
||
console.log(mod); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/combined-namespace-reexport/_expected/amd/main2.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-geometry'], function (geometry) { 'use strict'; | ||
|
||
console.log(geometry.foo, geometry.bar); | ||
|
||
}); |
20 changes: 20 additions & 0 deletions
20
test/chunking-form/samples/combined-namespace-reexport/_expected/cjs/generated-geometry.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 @@ | ||
'use strict'; | ||
|
||
const foo = 'foo'; | ||
|
||
var volume = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
foo: foo | ||
}); | ||
|
||
const bar = 'bar'; | ||
|
||
var geometry = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
bar: bar | ||
}); | ||
|
||
exports.bar = bar; | ||
exports.foo = foo; | ||
exports.geometry = geometry; | ||
exports.volume = volume; |
11 changes: 11 additions & 0 deletions
11
test/chunking-form/samples/combined-namespace-reexport/_expected/cjs/main1.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 @@ | ||
'use strict'; | ||
|
||
var geometry = require('./generated-geometry.js'); | ||
|
||
var mod = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
volume: geometry.volume, | ||
geometry: geometry.geometry | ||
}); | ||
|
||
console.log(mod); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/combined-namespace-reexport/_expected/cjs/main2.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 geometry = require('./generated-geometry.js'); | ||
|
||
console.log(geometry.foo, geometry.bar); |
15 changes: 15 additions & 0 deletions
15
test/chunking-form/samples/combined-namespace-reexport/_expected/es/generated-geometry.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 @@ | ||
const foo = 'foo'; | ||
|
||
var volume = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
foo: foo | ||
}); | ||
|
||
const bar = 'bar'; | ||
|
||
var geometry = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
bar: bar | ||
}); | ||
|
||
export { bar as b, foo as f, geometry as g, volume as v }; |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/combined-namespace-reexport/_expected/es/main1.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 @@ | ||
import { v as volume, g as geometry } from './generated-geometry.js'; | ||
|
||
var mod = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
volume: volume, | ||
geometry: geometry | ||
}); | ||
|
||
console.log(mod); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/combined-namespace-reexport/_expected/es/main2.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 @@ | ||
import { f as foo, b as bar } from './generated-geometry.js'; | ||
|
||
console.log(foo, bar); |
24 changes: 24 additions & 0 deletions
24
.../chunking-form/samples/combined-namespace-reexport/_expected/system/generated-geometry.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,24 @@ | ||
System.register([], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const foo = exports('f', 'foo'); | ||
|
||
var volume = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
foo: foo | ||
}); | ||
exports('v', volume); | ||
|
||
const bar = exports('b', 'bar'); | ||
|
||
var geometry = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
bar: bar | ||
}); | ||
exports('g', geometry); | ||
|
||
} | ||
}; | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/chunking-form/samples/combined-namespace-reexport/_expected/system/main1.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,21 @@ | ||
System.register(['./generated-geometry.js'], function () { | ||
'use strict'; | ||
var volume, geometry; | ||
return { | ||
setters: [function (module) { | ||
volume = module.v; | ||
geometry = module.g; | ||
}], | ||
execute: function () { | ||
|
||
var mod = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
volume: volume, | ||
geometry: geometry | ||
}); | ||
|
||
console.log(mod); | ||
|
||
} | ||
}; | ||
}); |
15 changes: 15 additions & 0 deletions
15
test/chunking-form/samples/combined-namespace-reexport/_expected/system/main2.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 @@ | ||
System.register(['./generated-geometry.js'], function () { | ||
'use strict'; | ||
var foo, bar; | ||
return { | ||
setters: [function (module) { | ||
foo = module.f; | ||
bar = module.b; | ||
}], | ||
execute: function () { | ||
|
||
console.log(foo, bar); | ||
|
||
} | ||
}; | ||
}); |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/combined-namespace-reexport/geometry.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 bar = 'bar'; |
2 changes: 2 additions & 0 deletions
2
test/chunking-form/samples/combined-namespace-reexport/index.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 * as volume from './volume'; | ||
export * as geometry from './geometry'; |
2 changes: 2 additions & 0 deletions
2
test/chunking-form/samples/combined-namespace-reexport/main1.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 @@ | ||
import * as mod from './index.js'; | ||
console.log(mod); |
4 changes: 4 additions & 0 deletions
4
test/chunking-form/samples/combined-namespace-reexport/main2.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 { bar } from './geometry.js'; | ||
import { foo } from './volume.js'; | ||
|
||
console.log(foo, bar); |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/combined-namespace-reexport/volume.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 foo = 'foo'; |
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/entry-point-without-own-code/_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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import './m2.js'; | ||
import { m as m1 } from './generated-m1.js'; | ||
import { m as ms } from './generated-m1.js'; | ||
|
||
console.log(m1); | ||
console.log(ms); |
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/namespace-reexport-name-conflict/_expected/es/main1.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import './generated-dep.js'; | ||
import 'external'; | ||
import { l as index } from './generated-index.js'; | ||
import { l as lib } from './generated-index.js'; | ||
|
||
console.log(index); | ||
console.log(lib); |
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/namespace-reexports/_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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { p } from './hsl2hsv.js'; | ||
import { l as index } from './generated-index.js'; | ||
import { l as lib } from './generated-index.js'; | ||
|
||
console.log(p); | ||
var main = new Map(Object.entries(index)); | ||
var main = new Map(Object.entries(lib)); | ||
|
||
export default main; |