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

@ -17,16 +17,13 @@ const {
} = _t;
function splitExportDeclaration(exportDeclaration) {
if (!exportDeclaration.isExportDeclaration()) {
throw new Error("Only export declarations can be split.");
if (!exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration()) {
throw new Error("Only default and named export declarations can be split.");
}
const isDefault = exportDeclaration.isExportDefaultDeclaration();
const declaration = exportDeclaration.get("declaration");
const isClassDeclaration = declaration.isClassDeclaration();
if (isDefault) {
const standaloneDeclaration = declaration.isFunctionDeclaration() || isClassDeclaration;
if (exportDeclaration.isExportDefaultDeclaration()) {
const declaration = exportDeclaration.get("declaration");
const standaloneDeclaration = declaration.isFunctionDeclaration() || declaration.isClassDeclaration();
const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope;
let id = declaration.node.id;
let needBindingRegistration = false;
@ -40,7 +37,7 @@ function splitExportDeclaration(exportDeclaration) {
}
}
const updatedDeclaration = standaloneDeclaration ? declaration : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]);
const updatedDeclaration = standaloneDeclaration ? declaration.node : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]);
const updatedExportDeclaration = exportNamedDeclaration(null, [exportSpecifier(cloneNode(id), identifier("default"))]);
exportDeclaration.insertAfter(updatedExportDeclaration);
exportDeclaration.replaceWith(updatedDeclaration);
@ -50,12 +47,11 @@ function splitExportDeclaration(exportDeclaration) {
}
return exportDeclaration;
}
if (exportDeclaration.get("specifiers").length > 0) {
} else if (exportDeclaration.get("specifiers").length > 0) {
throw new Error("It doesn't make sense to split exported specifiers.");
}
const declaration = exportDeclaration.get("declaration");
const bindingIdentifiers = declaration.getOuterBindingIdentifiers();
const specifiers = Object.keys(bindingIdentifiers).map(name => {
return exportSpecifier(identifier(name), identifier(name));