@babel/helper-module-transforms
Advanced tools
Comparing version 7.15.7 to 7.15.8
@@ -209,3 +209,3 @@ "use strict"; | ||
constantComputed: _template.default.statement`EXPORTS["EXPORT_NAME"] = NAMESPACE_IMPORT;`, | ||
spec: (0, _template.default)` | ||
spec: _template.default.statement` | ||
Object.defineProperty(EXPORTS, "EXPORT_NAME", { | ||
@@ -331,9 +331,10 @@ enumerable: true, | ||
const initStatements = []; | ||
const exportNames = []; | ||
for (const [localName, data] of metadata.local) { | ||
if (data.kind === "import") {} else if (data.kind === "hoisted") { | ||
initStatements.push(buildInitStatement(metadata, data.names, identifier(localName))); | ||
} else { | ||
exportNames.push(...data.names); | ||
initStatements.push([data.names[0], buildInitStatement(metadata, data.names, identifier(localName))]); | ||
} else if (!noIncompleteNsImportDetection) { | ||
for (const exportName of data.names) { | ||
initStatements.push([exportName, null]); | ||
} | ||
} | ||
@@ -344,17 +345,50 @@ } | ||
if (!constantReexports) { | ||
initStatements.push(...buildReexportsFromMeta(metadata, data, false)); | ||
const reexportsStatements = buildReexportsFromMeta(metadata, data, false); | ||
const reexports = [...data.reexports.keys()]; | ||
for (let i = 0; i < reexportsStatements.length; i++) { | ||
initStatements.push([reexports[i], reexportsStatements[i]]); | ||
} | ||
} | ||
for (const exportName of data.reexportNamespace) { | ||
exportNames.push(exportName); | ||
if (!noIncompleteNsImportDetection) { | ||
for (const exportName of data.reexportNamespace) { | ||
initStatements.push([exportName, null]); | ||
} | ||
} | ||
} | ||
if (!noIncompleteNsImportDetection) { | ||
initStatements.push(...chunk(exportNames, 100).map(members => { | ||
return buildInitStatement(metadata, members, programPath.scope.buildUndefinedNode()); | ||
})); | ||
initStatements.sort((a, b) => a[0] > b[0] ? 1 : -1); | ||
const results = []; | ||
if (noIncompleteNsImportDetection) { | ||
for (const [, initStatement] of initStatements) { | ||
results.push(initStatement); | ||
} | ||
} else { | ||
const chunkSize = 100; | ||
for (let i = 0, uninitializedExportNames = []; i < initStatements.length; i += chunkSize) { | ||
for (let j = 0; j < chunkSize && i + j < initStatements.length; j++) { | ||
const [exportName, initStatement] = initStatements[i + j]; | ||
if (initStatement !== null) { | ||
if (uninitializedExportNames.length > 0) { | ||
results.push(buildInitStatement(metadata, uninitializedExportNames, programPath.scope.buildUndefinedNode())); | ||
uninitializedExportNames = []; | ||
} | ||
results.push(initStatement); | ||
} else { | ||
uninitializedExportNames.push(exportName); | ||
} | ||
} | ||
if (uninitializedExportNames.length > 0) { | ||
results.push(buildInitStatement(metadata, uninitializedExportNames, programPath.scope.buildUndefinedNode())); | ||
} | ||
} | ||
} | ||
return initStatements; | ||
return results; | ||
} | ||
@@ -385,12 +419,2 @@ | ||
}, initExpr)); | ||
} | ||
function chunk(array, size) { | ||
const chunks = []; | ||
for (let i = 0; i < array.length; i += size) { | ||
chunks.push(array.slice(i, i + size)); | ||
} | ||
return chunks; | ||
} |
{ | ||
"name": "@babel/helper-module-transforms", | ||
"version": "7.15.7", | ||
"version": "7.15.8", | ||
"description": "Babel helper functions for implementing ES6 module transformations", | ||
@@ -5,0 +5,0 @@ "author": "The Babel Team (https://babel.dev/team)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39837
1056