Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "exports-only" option to preserveSignature (#3823)
- Loading branch information
1 parent
8cdbc61
commit 4b07a96
Showing
33 changed files
with
238 additions
and
16 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
2 changes: 1 addition & 1 deletion
2
test/chunking-form/samples/preserve-entry-signatures/allow-extension/_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
6 changes: 6 additions & 0 deletions
6
test/chunking-form/samples/preserve-entry-signatures/exports-only-no-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,6 @@ | ||
module.exports = { | ||
description: 'Does not create a facade for exports-only if there are no exports', | ||
options: { | ||
preserveEntrySignatures: 'exports-only' | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
...ples/preserve-entry-signatures/exports-only-no-exports/_expected/amd/generated-dynamic.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(['./main'], function (main) { 'use strict'; | ||
|
||
globalThis.sharedDynamic = main.shared; | ||
|
||
}); |
13 changes: 13 additions & 0 deletions
13
...king-form/samples/preserve-entry-signatures/exports-only-no-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,13 @@ | ||
define(['require', 'exports'], function (require, exports) { 'use strict'; | ||
|
||
const shared = 'shared'; | ||
|
||
new Promise(function (resolve, reject) { require(['./generated-dynamic'], resolve, reject) }); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
exports.shared = shared; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
...ples/preserve-entry-signatures/exports-only-no-exports/_expected/cjs/generated-dynamic.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 main = require('./main.js'); | ||
|
||
globalThis.sharedDynamic = main.shared; |
11 changes: 11 additions & 0 deletions
11
...king-form/samples/preserve-entry-signatures/exports-only-no-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,11 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
const shared = 'shared'; | ||
|
||
Promise.resolve().then(function () { return require('./generated-dynamic.js'); }); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
exports.shared = shared; |
3 changes: 3 additions & 0 deletions
3
...mples/preserve-entry-signatures/exports-only-no-exports/_expected/es/generated-dynamic.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 { s as shared } from './main.js'; | ||
|
||
globalThis.sharedDynamic = shared; |
7 changes: 7 additions & 0 deletions
7
...nking-form/samples/preserve-entry-signatures/exports-only-no-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,7 @@ | ||
const shared = 'shared'; | ||
|
||
import('./generated-dynamic.js'); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
export { shared as s }; |
14 changes: 14 additions & 0 deletions
14
...s/preserve-entry-signatures/exports-only-no-exports/_expected/system/generated-dynamic.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(['./main.js'], function () { | ||
'use strict'; | ||
var shared; | ||
return { | ||
setters: [function (module) { | ||
shared = module.s; | ||
}], | ||
execute: function () { | ||
|
||
globalThis.sharedDynamic = shared; | ||
|
||
} | ||
}; | ||
}); |
14 changes: 14 additions & 0 deletions
14
...g-form/samples/preserve-entry-signatures/exports-only-no-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,14 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const shared = exports('s', 'shared'); | ||
|
||
module.import('./generated-dynamic.js'); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
} | ||
}; | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-entry-signatures/exports-only-no-exports/dynamic.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 { shared } from './lib.js'; | ||
|
||
globalThis.sharedDynamic = shared; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/preserve-entry-signatures/exports-only-no-exports/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 @@ | ||
export const shared = 'shared'; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-entry-signatures/exports-only-no-exports/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,5 @@ | ||
import { shared } from './lib.js'; | ||
|
||
import('./dynamic.js'); | ||
|
||
globalThis.sharedStatic = shared; |
6 changes: 6 additions & 0 deletions
6
test/chunking-form/samples/preserve-entry-signatures/exports-only/_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: 'Creates a facade if necessary for exports-only if there are exports', | ||
options: { | ||
preserveEntrySignatures: 'exports-only' | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
...ng-form/samples/preserve-entry-signatures/exports-only/_expected/amd/generated-dynamic.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-main'], function (main) { 'use strict'; | ||
|
||
globalThis.sharedDynamic = main.shared; | ||
|
||
}); |
14 changes: 14 additions & 0 deletions
14
...nking-form/samples/preserve-entry-signatures/exports-only/_expected/amd/generated-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,14 @@ | ||
define(['require', 'exports'], function (require, exports) { 'use strict'; | ||
|
||
const shared = 'shared'; | ||
|
||
const unused = 'unused'; | ||
const dynamic = new Promise(function (resolve, reject) { require(['./generated-dynamic'], resolve, reject) }); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
exports.dynamic = dynamic; | ||
exports.shared = shared; | ||
exports.unused = unused; | ||
|
||
}); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/preserve-entry-signatures/exports-only/_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,10 @@ | ||
define(['exports', './generated-main'], function (exports, main) { 'use strict'; | ||
|
||
|
||
|
||
exports.dynamic = main.dynamic; | ||
exports.unused = main.unused; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
...ng-form/samples/preserve-entry-signatures/exports-only/_expected/cjs/generated-dynamic.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 main = require('./generated-main.js'); | ||
|
||
globalThis.sharedDynamic = main.shared; |
12 changes: 12 additions & 0 deletions
12
...nking-form/samples/preserve-entry-signatures/exports-only/_expected/cjs/generated-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 @@ | ||
'use strict'; | ||
|
||
const shared = 'shared'; | ||
|
||
const unused = 'unused'; | ||
const dynamic = Promise.resolve().then(function () { return require('./generated-dynamic.js'); }); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
exports.dynamic = dynamic; | ||
exports.shared = shared; | ||
exports.unused = unused; |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/preserve-entry-signatures/exports-only/_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 }); | ||
|
||
var main = require('./generated-main.js'); | ||
|
||
|
||
|
||
exports.dynamic = main.dynamic; | ||
exports.unused = main.unused; |
3 changes: 3 additions & 0 deletions
3
...ing-form/samples/preserve-entry-signatures/exports-only/_expected/es/generated-dynamic.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 { s as shared } from './generated-main.js'; | ||
|
||
globalThis.sharedDynamic = shared; |
8 changes: 8 additions & 0 deletions
8
...unking-form/samples/preserve-entry-signatures/exports-only/_expected/es/generated-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,8 @@ | ||
const shared = 'shared'; | ||
|
||
const unused = 'unused'; | ||
const dynamic = import('./generated-dynamic.js'); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
export { dynamic as d, shared as s, unused as u }; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/preserve-entry-signatures/exports-only/_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 @@ | ||
export { d as dynamic, u as unused } from './generated-main.js'; |
14 changes: 14 additions & 0 deletions
14
...form/samples/preserve-entry-signatures/exports-only/_expected/system/generated-dynamic.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-main.js'], function () { | ||
'use strict'; | ||
var shared; | ||
return { | ||
setters: [function (module) { | ||
shared = module.s; | ||
}], | ||
execute: function () { | ||
|
||
globalThis.sharedDynamic = shared; | ||
|
||
} | ||
}; | ||
}); |
15 changes: 15 additions & 0 deletions
15
...ng-form/samples/preserve-entry-signatures/exports-only/_expected/system/generated-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,15 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const shared = exports('s', 'shared'); | ||
|
||
const unused = exports('u', 'unused'); | ||
const dynamic = exports('d', module.import('./generated-dynamic.js')); | ||
|
||
globalThis.sharedStatic = shared; | ||
|
||
} | ||
}; | ||
}); |
16 changes: 16 additions & 0 deletions
16
test/chunking-form/samples/preserve-entry-signatures/exports-only/_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,16 @@ | ||
System.register(['./generated-main.js'], function (exports) { | ||
'use strict'; | ||
return { | ||
setters: [function (module) { | ||
var _setter = {}; | ||
_setter.dynamic = module.d; | ||
_setter.unused = module.u; | ||
exports(_setter); | ||
}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-entry-signatures/exports-only/dynamic.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 { shared } from './lib.js'; | ||
|
||
globalThis.sharedDynamic = shared; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/preserve-entry-signatures/exports-only/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 @@ | ||
export const shared = 'shared'; |
6 changes: 6 additions & 0 deletions
6
test/chunking-form/samples/preserve-entry-signatures/exports-only/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 @@ | ||
import { shared } from './lib.js'; | ||
|
||
export const unused = 'unused'; | ||
export const dynamic = import('./dynamic.js'); | ||
|
||
globalThis.sharedStatic = shared; |