Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent unneeded exports when entry facades are created and ensure al…
…l exported variables in facades are imported (#3590) * Prevent unneeded exports when entry facades are created and ensure all exported variables in facades are imported * Add test for namespaces with default reexport
- Loading branch information
1 parent
36a4527
commit c126c94
Showing
65 changed files
with
577 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
description: 'does not create a facade for one circular entry point if possible', | ||
expectedWarnings: ['CIRCULAR_DEPENDENCY'], | ||
options: { | ||
input: ['main1.js', 'main2.js'] | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/circular-entry-points2/_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,9 @@ | ||
define(['exports', './main2'], function (exports, main2) { 'use strict'; | ||
|
||
|
||
|
||
exports.p = main2.p2; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
28 changes: 28 additions & 0 deletions
28
test/chunking-form/samples/circular-entry-points2/_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,28 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
class C { | ||
fn (num) { | ||
console.log(num - p$1); | ||
} | ||
} | ||
|
||
var p = 43; | ||
|
||
new C().fn(p); | ||
|
||
class C$1 { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
|
||
var p$1 = 42; | ||
|
||
new C$1().fn(p$1); | ||
|
||
exports.p = p; | ||
exports.p2 = p$1; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/circular-entry-points2/_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,9 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var main2 = require('./main2.js'); | ||
|
||
|
||
|
||
exports.p = main2.p2; |
26 changes: 26 additions & 0 deletions
26
test/chunking-form/samples/circular-entry-points2/_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,26 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
class C { | ||
fn (num) { | ||
console.log(num - p$1); | ||
} | ||
} | ||
|
||
var p = 43; | ||
|
||
new C().fn(p); | ||
|
||
class C$1 { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
|
||
var p$1 = 42; | ||
|
||
new C$1().fn(p$1); | ||
|
||
exports.p = p; | ||
exports.p2 = p$1; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/circular-entry-points2/_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 @@ | ||
export { p2 as p } from './main2.js'; |
21 changes: 21 additions & 0 deletions
21
test/chunking-form/samples/circular-entry-points2/_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,21 @@ | ||
class C { | ||
fn (num) { | ||
console.log(num - p$1); | ||
} | ||
} | ||
|
||
var p = 43; | ||
|
||
new C().fn(p); | ||
|
||
class C$1 { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
|
||
var p$1 = 42; | ||
|
||
new C$1().fn(p$1); | ||
|
||
export { p, p$1 as p2 }; |
13 changes: 13 additions & 0 deletions
13
test/chunking-form/samples/circular-entry-points2/_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,13 @@ | ||
System.register(['./main2.js'], function (exports) { | ||
'use strict'; | ||
return { | ||
setters: [function (module) { | ||
exports('p', module.p2); | ||
}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
28 changes: 28 additions & 0 deletions
28
test/chunking-form/samples/circular-entry-points2/_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,28 @@ | ||
System.register([], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
class C { | ||
fn (num) { | ||
console.log(num - p$1); | ||
} | ||
} | ||
|
||
var p = exports('p', 43); | ||
|
||
new C().fn(p); | ||
|
||
class C$1 { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
|
||
var p$1 = exports('p2', 42); | ||
|
||
new C$1().fn(p$1); | ||
|
||
} | ||
}; | ||
}); |
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 { p } from './main2.js'; | ||
|
||
export class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} |
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 { p } from './main1.js'; | ||
|
||
export class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} |
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 { C } from './dep1.js'; | ||
export var p = 42; | ||
|
||
new C().fn(p); |
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 @@ | ||
import { C } from './dep2.js'; | ||
export var p = 43; | ||
export {p as p2} from './main1' | ||
|
||
new C().fn(p); |
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 @@ | ||
module.exports = { | ||
description: | ||
'creates facades for all circular entry points if they become tainted by another entry', | ||
expectedWarnings: ['CIRCULAR_DEPENDENCY'], | ||
options: { | ||
input: ['main1.js', 'main2.js', 'main3.js'] | ||
} | ||
}; |
Oops, something went wrong.