v3 new release (#84)

swap to graphql
This commit is contained in:
github-actions[bot]
2022-07-11 13:48:02 -04:00
committed by GitHub
parent 20d2b4f98d
commit e4f3964f67
1492 changed files with 63799 additions and 63001 deletions

View File

@@ -80,6 +80,7 @@ function rewriteModuleStatementsAndPrepareHeader(path, {
importInterop = noInterop ? "none" : "babel",
lazy,
esNamespaceOnly,
filename,
constantReexports = loose,
enumerableModuleMeta = loose,
noIncompleteNsImportDetection
@@ -93,7 +94,8 @@ function rewriteModuleStatementsAndPrepareHeader(path, {
importInterop,
initializeReexports: constantReexports,
lazy,
esNamespaceOnly
esNamespaceOnly,
filename
});
if (!allowTopLevelThis) {
@@ -355,7 +357,11 @@ function buildExportInitializationStatements(programPath, metadata, constantReex
}
}
initStatements.sort((a, b) => a[0] > b[0] ? 1 : -1);
initStatements.sort(([a], [b]) => {
if (a < b) return -1;
if (b < a) return 1;
return 0;
});
const results = [];
if (noIncompleteNsImportDetection) {
@@ -365,7 +371,9 @@ function buildExportInitializationStatements(programPath, metadata, constantReex
} else {
const chunkSize = 100;
for (let i = 0, uninitializedExportNames = []; i < initStatements.length; i += chunkSize) {
for (let i = 0; i < initStatements.length; i += chunkSize) {
let uninitializedExportNames = [];
for (let j = 0; j < chunkSize && i + j < initStatements.length; j++) {
const [exportName, initStatement] = initStatements[i + j];

View File

@@ -30,9 +30,9 @@ function validateImportInteropOption(importInterop) {
return importInterop;
}
function resolveImportInterop(importInterop, source) {
function resolveImportInterop(importInterop, source, filename) {
if (typeof importInterop === "function") {
return validateImportInteropOption(importInterop(source));
return validateImportInteropOption(importInterop(source, filename));
}
return importInterop;
@@ -42,7 +42,8 @@ function normalizeModuleAndLoadMetadata(programPath, exportName, {
importInterop,
initializeReexports = false,
lazy = false,
esNamespaceOnly = false
esNamespaceOnly = false,
filename
}) {
if (!exportName) {
exportName = programPath.scope.generateUidIdentifier("exports").name;
@@ -65,7 +66,7 @@ function normalizeModuleAndLoadMetadata(programPath, exportName, {
metadata.name = metadata.importsNamespace.values().next().value;
}
const resolvedInterop = resolveImportInterop(importInterop, metadata.source);
const resolvedInterop = resolveImportInterop(importInterop, metadata.source, filename);
if (resolvedInterop === "none") {
metadata.interop = "none";
@@ -269,7 +270,9 @@ function getLocalExportMetadata(programPath, initializeReexports, stringSpecifie
if (child.isImportDeclaration()) {
kind = "import";
} else {
if (child.isExportDefaultDeclaration()) child = child.get("declaration");
if (child.isExportDefaultDeclaration()) {
child = child.get("declaration");
}
if (child.isExportNamedDeclaration()) {
if (child.node.declaration) {

View File

@@ -90,7 +90,7 @@ function rewriteLiveReferences(programPath, metadata) {
exported
};
programPath.traverse(rewriteBindingInitVisitor, rewriteBindingInitVisitorState);
(0, _helperSimpleAccess.default)(programPath, new Set([...Array.from(imported.keys()), ...Array.from(exported.keys())]));
(0, _helperSimpleAccess.default)(programPath, new Set([...Array.from(imported.keys()), ...Array.from(exported.keys())]), false);
const rewriteReferencesVisitorState = {
seen: new WeakSet(),
metadata,
@@ -102,7 +102,10 @@ function rewriteLiveReferences(programPath, metadata) {
const meta = metadata.source.get(source);
if (localName) {
if (meta.lazy) identNode = callExpression(identNode, []);
if (meta.lazy) {
identNode = callExpression(identNode, []);
}
return identNode;
}
@@ -230,6 +233,47 @@ const rewriteReferencesVisitor = {
}
},
UpdateExpression(path) {
const {
scope,
seen,
imported,
exported,
requeueInParent,
buildImportReference
} = this;
if (seen.has(path.node)) return;
seen.add(path.node);
const arg = path.get("argument");
if (arg.isMemberExpression()) return;
const update = path.node;
if (arg.isIdentifier()) {
const localName = arg.node.name;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
const exportedNames = exported.get(localName);
const importData = imported.get(localName);
if ((exportedNames == null ? void 0 : exportedNames.length) > 0 || importData) {
if (importData) {
path.replaceWith(assignmentExpression(update.operator[0] + "=", buildImportReference(importData, arg.node), buildImportThrow(localName)));
} else if (update.prefix) {
path.replaceWith(buildBindingExportAssignmentExpression(this.metadata, exportedNames, cloneNode(update)));
} else {
const ref = scope.generateDeclaredUidIdentifier(localName);
path.replaceWith(sequenceExpression([assignmentExpression("=", cloneNode(ref), cloneNode(update)), buildBindingExportAssignmentExpression(this.metadata, exportedNames, identifier(localName)), cloneNode(ref)]));
}
}
}
requeueInParent(path);
path.skip();
},
AssignmentExpression: {
exit(path) {
const {
@@ -261,7 +305,7 @@ const rewriteReferencesVisitor = {
const assignment = path.node;
if (importData) {
assignment.left = buildImportReference(importData, assignment.left);
assignment.left = buildImportReference(importData, left.node);
assignment.right = sequenceExpression([assignment.right, buildImportThrow(localName)]);
}

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/helper-module-transforms",
"version": "7.16.7",
"version": "7.18.6",
"description": "Babel helper functions for implementing ES6 module transformations",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-transforms",
@@ -15,16 +15,17 @@
},
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-environment-visitor": "^7.16.7",
"@babel/helper-module-imports": "^7.16.7",
"@babel/helper-simple-access": "^7.16.7",
"@babel/helper-split-export-declaration": "^7.16.7",
"@babel/helper-validator-identifier": "^7.16.7",
"@babel/template": "^7.16.7",
"@babel/traverse": "^7.16.7",
"@babel/types": "^7.16.7"
"@babel/helper-environment-visitor": "^7.18.6",
"@babel/helper-module-imports": "^7.18.6",
"@babel/helper-simple-access": "^7.18.6",
"@babel/helper-split-export-declaration": "^7.18.6",
"@babel/helper-validator-identifier": "^7.18.6",
"@babel/template": "^7.18.6",
"@babel/traverse": "^7.18.6",
"@babel/types": "^7.18.6"
},
"engines": {
"node": ">=6.9.0"
}
},
"type": "commonjs"
}