mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Merge pull request #3945 from Microsoft/bulkReexportInSystem
System: use batching when doing star exports
This commit is contained in:
@@ -5779,6 +5779,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(`function ${exportStarFunction}(m) {`);
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
write(`var exports = {};`);
|
||||
writeLine();
|
||||
write(`for(var n in m) {`);
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
@@ -5786,10 +5788,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (localNames) {
|
||||
write(`&& !${localNames}.hasOwnProperty(n)`);
|
||||
}
|
||||
write(`) ${exportFunctionForFile}(n, m[n]);`);
|
||||
write(`) exports[n] = m[n];`);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("}");
|
||||
writeLine();
|
||||
write(`${exportFunctionForFile}(exports);`)
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("}");
|
||||
@@ -6122,16 +6126,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if ((<ExportDeclaration>importNode).exportClause) {
|
||||
// export {a, b as c} from 'foo'
|
||||
// emit as:
|
||||
// exports('a', _foo["a"])
|
||||
// exports('c', _foo["b"])
|
||||
// var reexports = {}
|
||||
// reexports['a'] = _foo["a"];
|
||||
// reexports['c'] = _foo["b"];
|
||||
// exports_(reexports);
|
||||
let reexportsVariableName = makeUniqueName("reexports");
|
||||
writeLine();
|
||||
write(`var ${reexportsVariableName} = {};`)
|
||||
writeLine();
|
||||
for (let e of (<ExportDeclaration>importNode).exportClause.elements) {
|
||||
writeLine();
|
||||
write(`${exportFunctionForFile}("`);
|
||||
write(`${reexportsVariableName}["`);
|
||||
emitNodeWithoutSourceMap(e.name);
|
||||
write(`", ${parameterName}["`);
|
||||
write(`"] = ${parameterName}["`);
|
||||
emitNodeWithoutSourceMap(e.propertyName || e.name);
|
||||
write(`"]);`);
|
||||
write(`"];`);
|
||||
writeLine();
|
||||
}
|
||||
write(`${exportFunctionForFile}(${reexportsVariableName});`);
|
||||
}
|
||||
else {
|
||||
writeLine();
|
||||
|
||||
@@ -51,9 +51,11 @@ System.register(['bar'], function(exports_1) {
|
||||
'foo': true
|
||||
};
|
||||
function exportStar_1(m) {
|
||||
var exports = {};
|
||||
for(var n in m) {
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n];
|
||||
}
|
||||
exports_1(exports);
|
||||
}
|
||||
return {
|
||||
setters:[
|
||||
@@ -72,9 +74,11 @@ System.register(['bar'], function(exports_1) {
|
||||
'y1': true
|
||||
};
|
||||
function exportStar_1(m) {
|
||||
var exports = {};
|
||||
for(var n in m) {
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n];
|
||||
}
|
||||
exports_1(exports);
|
||||
}
|
||||
return {
|
||||
setters:[
|
||||
@@ -96,15 +100,19 @@ System.register(['a', 'bar'], function(exports_1) {
|
||||
'z': true
|
||||
};
|
||||
function exportStar_1(m) {
|
||||
var exports = {};
|
||||
for(var n in m) {
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n];
|
||||
}
|
||||
exports_1(exports);
|
||||
}
|
||||
return {
|
||||
setters:[
|
||||
function (_a_1) {
|
||||
exports_1("x", _a_1["x"]);
|
||||
exports_1("z", _a_1["y"]);
|
||||
var reexports_1 = {};
|
||||
reexports_1["x"] = _a_1["x"];
|
||||
reexports_1["z"] = _a_1["y"];
|
||||
exports_1(reexports_1);
|
||||
},
|
||||
function (_bar_1) {
|
||||
exportStar_1(_bar_1);
|
||||
@@ -123,8 +131,10 @@ System.register(['a'], function(exports_1) {
|
||||
return {
|
||||
setters:[
|
||||
function (_a_1) {
|
||||
exports_1("s", _a_1["s"]);
|
||||
exports_1("s2", _a_1["s1"]);
|
||||
var reexports_1 = {};
|
||||
reexports_1["s"] = _a_1["s"];
|
||||
reexports_1["s2"] = _a_1["s1"];
|
||||
exports_1(reexports_1);
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("z", z);
|
||||
@@ -136,9 +146,11 @@ System.register(['a'], function(exports_1) {
|
||||
System.register(['a'], function(exports_1) {
|
||||
function foo() { }
|
||||
function exportStar_1(m) {
|
||||
var exports = {};
|
||||
for(var n in m) {
|
||||
if (n !== "default") exports_1(n, m[n]);
|
||||
if (n !== "default") exports[n] = m[n];
|
||||
}
|
||||
exports_1(exports);
|
||||
}
|
||||
return {
|
||||
setters:[
|
||||
|
||||
@@ -30,9 +30,11 @@ System.register(['file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7'],
|
||||
'z': true
|
||||
};
|
||||
function exportStar_1(m) {
|
||||
var exports = {};
|
||||
for(var n in m) {
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n];
|
||||
}
|
||||
exports_1(exports);
|
||||
}
|
||||
return {
|
||||
setters:[
|
||||
|
||||
Reference in New Issue
Block a user