1 line
34 KiB
Text
1 line
34 KiB
Text
|
{"version":3,"names":["_assert","require","_core","_helperSimpleAccess","assignmentExpression","cloneNode","expressionStatement","getOuterBindingIdentifiers","identifier","isArrowFunctionExpression","isClassExpression","isFunctionExpression","isIdentifier","isMemberExpression","isVariableDeclaration","jsxIdentifier","jsxMemberExpression","memberExpression","numericLiteral","sequenceExpression","stringLiteral","variableDeclaration","variableDeclarator","t","isInType","path","parent","type","parentPath","exportKind","isStatement","isExpression","rewriteLiveReferences","programPath","metadata","wrapReference","imported","Map","exported","requeueInParent","requeue","source","data","localName","importName","imports","set","importsNamespace","local","exportMeta","get","push","names","rewriteBindingInitVisitorState","scope","traverse","rewriteBindingInitVisitor","bindingNames","Set","Array","from","keys","simplifyAccess","rewriteReferencesVisitorState","seen","WeakSet","buildImportReference","identNode","meta","referenced","wrap","_wrapReference","namespace","name","_wrapReference2","interop","computed","stringSpecifiers","has","rewriteReferencesVisitor","Scope","skip","ClassDeclaration","id","node","Error","exportNames","length","statement","buildBindingExportAssignmentExpression","_blockHoist","insertAfter","VariableDeclaration","isVar","kind","decl","init","buildUndefinedNode","Object","localExpr","exportsObjectName","exportName","currentScope","hasOwnBinding","rename","reduce","expr","buildImportThrow","template","expression","ast","ReferencedIdentifier","add","importData","buildCodeFrameError","localBinding","getBinding","rootBinding","ref","loc","isCallExpression","callee","isOptionalCallExpression","isTaggedTemplateExpression","tag","replaceWith","isJSXIdentifier","object","property","UpdateExpression","arg","update","exportedNames","operator","prefix","generateDeclaredUidIdentifier","AssignmentExpression","exit","left","assert","assignment","right","ids","programScopeIds","filter","find","items","forEach","isExpressionStatement","ForOfStatement|ForInStatement","programScope","didTransformExport","importConstViolationName","loopBodyScope","ensureBlock","bodyPath","newLoopId","generateUidIdentifierBasedOnNode","registerDeclaration","unshiftContainer"],"sources":["../src/rewrite-live-references.ts"],"sourcesContent":["import assert from \"assert\";\nimport { template, types as t } from \"@babel/core\";\nimport type { NodePath, Visitor, Scope } from \"@babel/traverse\";\nimport simplifyAccess from \"@babel/helper-simple-access\";\n\nimport type { ModuleMetadata } from \"./normalize-and-load-metadata.ts\";\n\nconst {\n assignmentExpression,\n cloneNode,\n expressionStatement,\n getOuterBindingIdentifiers,\n identifier,\n isArrowFunctionExpression,\n isClassExpression,\n isFunctionExpression,\n isIdentifier,\n isMemberExpression,\n isVariableDeclaration,\n jsxIdentifier,\n jsxMemberExpression,\n memberExpression,\n numericLiteral,\n sequenceExpression,\n stringLiteral,\n variableDeclaration,\n variableDeclarator,\n} = t;\n\ninterface RewriteReferencesVisitorState {\n exported: Map<any, any>;\n metadata: ModuleMetadata;\n requeueInParent: (path: NodePath) => void;\n scope: Scope;\n imported: Map<any, any>;\n buildImportReference: (\n [source, importName, localName]: readonly [string, string, string],\n identNode: t.Identifier | t.CallExpression | t.JSXIdentifier,\n ) => any;\n seen: WeakSet<object>;\n}\n\ninterface RewriteBindingInitVisitorState {\n exported: Map<any, any>;\n metadata: ModuleMetadata;\n requeueInParent: (path: NodePath) => void;\n scope: Scope;\n}\n\nfunction isInType(path: NodePath) {\n do {\n switch (path.parent.type) {\n case \"TSTypeAnnotation\":\n case \"TSTypeAliasDeclaration\":\n case \"TSTypeReference\":\n case \"TypeAnnotation\":\n case \"TypeAlias\":\n return true;\n case \"ExportSpecifier\":\n return (\n (\n path.parentPath.parent as\n | t.ExportDefaultDeclaration\n | t
|