timepiece/node_modules/@babel/helpers/lib/index.js.map

1 line
20 KiB
Plaintext

{"version":3,"names":["_traverse","require","_t","_helpers","assignmentExpression","cloneNode","expressionStatement","file","identifier","makePath","path","parts","parentPath","push","key","inList","listKey","reverse","join","FileClass","undefined","getHelperMetadata","globals","Set","localBindingNames","dependencies","Map","exportName","exportPath","exportBindingAssignments","importPaths","importBindingsReferences","dependencyVisitor","ImportDeclaration","child","name","node","source","value","helpers","buildCodeFrameError","get","length","isImportDefaultSpecifier","bindingIdentifier","specifiers","local","set","ExportDefaultDeclaration","decl","isFunctionDeclaration","id","ExportAllDeclaration","ExportNamedDeclaration","Statement","isImportDeclaration","isExportDeclaration","skip","referenceVisitor","Program","bindings","scope","getAllBindings","Object","keys","forEach","has","add","ReferencedIdentifier","binding","getBinding","AssignmentExpression","left","getBindingIdentifiers","isIdentifier","isProgram","traverse","ast","Error","Array","from","permuteHelperAST","metadata","localBindings","getDependency","dependenciesRefs","toRename","type","newName","exp","imps","map","p","impsBindingRefs","replaceWith","assignPath","assign","pushContainer","rename","remove","helperData","create","loadHelper","helper","ReferenceError","code","fn","fakeFile","stop","filename","inputMap","minVersion","build","nodes","program","body","getDependencies","values","ensure","newFileClass","list","exports","replace","_default","default"],"sources":["../src/index.ts"],"sourcesContent":["import type { File } from \"@babel/core\";\nimport type { NodePath, Visitor } from \"@babel/traverse\";\nimport traverse from \"@babel/traverse\";\nimport {\n assignmentExpression,\n cloneNode,\n expressionStatement,\n file,\n identifier,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport helpers from \"./helpers.ts\";\n\nfunction makePath(path: NodePath) {\n const parts = [];\n\n for (; path.parentPath; path = path.parentPath) {\n parts.push(path.key);\n if (path.inList) parts.push(path.listKey);\n }\n\n return parts.reverse().join(\".\");\n}\n\nlet FileClass: typeof File | undefined = undefined;\n\ninterface HelperMetadata {\n globals: string[];\n localBindingNames: string[];\n dependencies: Map<t.Identifier, string>;\n exportBindingAssignments: string[];\n exportPath: string;\n exportName: string;\n importBindingsReferences: string[];\n importPaths: string[];\n}\n\n/**\n * Given a file AST for a given helper, get a bunch of metadata about it so that Babel can quickly render\n * the helper is whatever context it is needed in.\n */\nfunction getHelperMetadata(file: File): HelperMetadata {\n const globals = new Set<string>();\n const localBindingNames = new Set<string>();\n // Maps imported identifier -> helper name\n const dependencies = new Map<t.Identifier, string>();\n\n let exportName: string | undefined;\n let exportPath: string | undefined;\n const exportBindingAssignments: string[] = [];\n const importPaths: string[] = [];\n const importBindingsReferences: string[] = [];\n\n const dependencyVisitor: Visitor = {\n ImportDeclaration(child) {\n const name = child.node.source.value;\n if (!helpers[name]) {\n throw child.buildCodeFrameError(`Unknown helper ${name}`);\n }\n if (\n child.get(\"specifiers\").length !== 1 ||\n // @ts-expect-error isImportDefaultSpecifier does not work with NodePath union\n !child.get(\"specifiers.0\").isImportDefaultSpecifier()\n ) {\n throw child.buildCodeFrameError(\n \"Helpers can only import a default value\",\n );\n }\n const bindingIdentifier = child.node.specifiers[0].local;\n dependencies.set(bindingIdentifier, name);\n importPaths.push(makePath(child));\n },\n ExportDefaultDeclaration(child) {\n const decl = child.get(\"declaration\");\n\n if (!decl.isFunctionDeclaration() || !decl.node.id) {\n throw decl.buildCodeFrameError(\n \"Helpers can only export named function declarations\",\n );\n }\n\n exportName = decl.node.id.name;\n exportPath = makePath(child);\n },\n ExportAllDeclaration(child) {\n throw child.buildCodeFrameError(\"Helpers can only export default\");\n },\n ExportNamedDeclaration(child) {\n throw child.buildCodeFrameError(\"Helpers can only export default\");\n },\n Statement(child) {\n if (child.isImportDeclaration() || child.isExportDeclaration()) return;\n\n child.skip();\n },\n };\n\n const referenceVisitor: Visitor = {\n Program(path) {\n const bindings = path.scope.getAllBindings();\n\n Object.keys(bindings).forEach(name => {\n if (name === exportName) return;\n if (dependencies.has(bindings[name].identifier)) return;\n\n localBindingNames.add(name);\n });\n },\n ReferencedIdentifier(child) {\n const name = child.node.name;\n const binding = child.scope.getBinding(name);\n if (!binding) {\n globals.add(name);\n } else if (dependencies.has(binding.identifier)) {\n importBindingsReferences.push(makePath(child));\n }\n },\n AssignmentExpression(child) {\n const left = child.get(\"left\");\n\n if (!(exportName in left.getBindingIdentifiers())) return;\n\n if (!left.isIdentifier()) {\n throw left.buildCodeFrameError(\n \"Only simple assignments to exports are allowed in helpers\",\n );\n }\n\n const binding = child.scope.getBinding(exportName);\n\n if (binding?.scope.path.isProgram()) {\n exportBindingAssignments.push(makePath(child));\n }\n },\n };\n\n traverse(file.ast, dependencyVisitor, file.scope);\n traverse(file.ast, referenceVisitor, file.scope);\n\n if (!exportPath) throw new Error(\"Helpers must have a default export.\");\n\n // Process these in reverse so that mutating the references does not invalidate any later paths in\n // the list.\n exportBindingAssignments.reverse();\n\n return {\n globals: Array.from(globals),\n localBindingNames: Array.from(localBindingNames),\n dependencies,\n exportBindingAssignments,\n exportPath,\n exportName,\n importBindingsReferences,\n importPaths,\n };\n}\n\ntype GetDependency = (name: string) => t.Expression;\n\n/**\n * Given a helper AST and information about how it will be used, update the AST to match the usage.\n */\nfunction permuteHelperAST(\n file: File,\n metadata: HelperMetadata,\n id?: t.Identifier | t.MemberExpression,\n localBindings?: string[],\n getDependency?: GetDependency,\n) {\n if (localBindings && !id) {\n throw new Error(\"Unexpected local bindings for module-based helpers.\");\n }\n\n if (!id) return;\n\n const {\n localBindingNames,\n dependencies,\n exportBindingAssignments,\n exportPath,\n exportName,\n importBindingsReferences,\n importPaths,\n } = metadata;\n\n const dependenciesRefs: Record<string, t.Expression> = {};\n dependencies.forEach((name, id) => {\n dependenciesRefs[id.name] =\n (typeof getDependency === \"function\" && getDependency(name)) || id;\n });\n\n const toRename: Record<string, string> = {};\n const bindings = new Set(localBindings || []);\n if (id.type === \"Identifier\") bindings.add(id.name);\n localBindingNames.forEach(name => {\n let newName = name;\n while (bindings.has(newName)) newName = \"_\" + newName;\n\n if (newName !== name) toRename[name] = newName;\n });\n\n if (id.type === \"Identifier\" && exportName !== id.name) {\n toRename[exportName] = id.name;\n }\n\n const { path } = file;\n\n // We need to compute these in advance because removing nodes would\n // invalidate the paths.\n const exp: NodePath<t.ExportDefaultDeclaration> = path.get(exportPath);\n const imps: NodePath<t.ImportDeclaration>[] = importPaths.map(p =>\n path.get(p),\n );\n const impsBindingRefs: NodePath<t.Identifier>[] =\n importBindingsReferences.map(p => path.get(p));\n\n // We assert that this is a FunctionDeclaration in dependencyVisitor.\n const decl = exp.get(\"declaration\") as NodePath<t.FunctionDeclaration>;\n\n if (id.type === \"Identifier\") {\n exp.replaceWith(decl);\n } else if (id.type === \"MemberExpression\") {\n exportBindingAssignments.forEach(assignPath => {\n const assign: NodePath<t.Expression> = path.get(assignPath);\n assign.replaceWith(assignmentExpression(\"=\", id, assign.node));\n });\n exp.replaceWith(decl);\n path.pushContainer(\n \"body\",\n expressionStatement(\n assignmentExpression(\"=\", id, identifier(exportName)),\n ),\n );\n } else {\n throw new Error(\"Unexpected helper format.\");\n }\n\n Object.keys(toRename).forEach(name => {\n path.scope.rename(name, toRename[name]);\n });\n\n for (const path of imps) path.remove();\n for (const path of impsBindingRefs) {\n const node = cloneNode(dependenciesRefs[path.node.name]);\n path.replaceWith(node);\n }\n}\n\ninterface HelperData {\n build: (\n getDependency: GetDependency,\n id: t.Identifier | t.MemberExpression,\n localBindings: string[],\n ) => {\n nodes: t.Program[\"body\"];\n globals: string[];\n };\n minVersion: string;\n getDependencies: () => string[];\n}\n\nconst helperData: Record<string, HelperData> = Object.create(null);\nfunction loadHelper(name: string) {\n if (!helperData[name]) {\n const helper = helpers[name];\n if (!helper) {\n throw Object.assign(new ReferenceError(`Unknown helper ${name}`), {\n code: \"BABEL_HELPER_UNKNOWN\",\n helper: name,\n });\n }\n\n const fn = (): File => {\n if (!process.env.BABEL_8_BREAKING) {\n if (!FileClass) {\n const fakeFile = { ast: file(helper.ast()), path: null } as File;\n traverse(fakeFile.ast, {\n Program: path => (fakeFile.path = path).stop(),\n });\n return fakeFile;\n }\n }\n return new FileClass(\n { filename: `babel-helper://${name}` },\n {\n ast: file(helper.ast()),\n code: \"[internal Babel helper code]\",\n inputMap: null,\n },\n );\n };\n\n // We compute the helper metadata lazily, so that we skip that\n // work if we only need the `.minVersion` (for example because\n // of a call to `.availableHelper` when `@babel/runtime`).\n let metadata: HelperMetadata | null = null;\n\n helperData[name] = {\n minVersion: helper.minVersion,\n build(getDependency, id, localBindings) {\n const file = fn();\n metadata ||= getHelperMetadata(file);\n permuteHelperAST(file, metadata, id, localBindings, getDependency);\n\n return {\n nodes: file.ast.program.body,\n globals: metadata.globals,\n };\n },\n getDependencies() {\n metadata ||= getHelperMetadata(fn());\n return Array.from(metadata.dependencies.values());\n },\n };\n }\n\n return helperData[name];\n}\n\nexport function get(\n name: string,\n getDependency?: GetDependency,\n id?: t.Identifier | t.MemberExpression,\n localBindings?: string[],\n) {\n return loadHelper(name).build(getDependency, id, localBindings);\n}\n\nexport function minVersion(name: string) {\n return loadHelper(name).minVersion;\n}\n\nexport function getDependencies(name: string): ReadonlyArray<string> {\n return loadHelper(name).getDependencies();\n}\n\nexport function ensure(name: string, newFileClass: typeof File) {\n // We inject the File class here rather than importing it to avoid\n // circular dependencies between @babel/core and @babel/helpers.\n FileClass ||= newFileClass;\n\n loadHelper(name);\n}\n\nexport const list = Object.keys(helpers).map(name => name.replace(/^_/, \"\"));\n\nexport default get;\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAD,OAAA;AAQA,IAAAE,QAAA,GAAAF,OAAA;AAAmC;EAPjCG,oBAAoB;EACpBC,SAAS;EACTC,mBAAmB;EACnBC,IAAI;EACJC;AAAU,IAAAN,EAAA;AAKZ,SAASO,QAAQA,CAACC,IAAc,EAAE;EAChC,MAAMC,KAAK,GAAG,EAAE;EAEhB,OAAOD,IAAI,CAACE,UAAU,EAAEF,IAAI,GAAGA,IAAI,CAACE,UAAU,EAAE;IAC9CD,KAAK,CAACE,IAAI,CAACH,IAAI,CAACI,GA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