amis-rpc-design/node_modules/@babel/plugin-transform-object-super/lib/index.js.map

1 line
2.9 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"names":["_helperPluginUtils","require","_helperReplaceSupers","_core","replacePropertySuper","path","getObjectRef","file","replaceSupers","ReplaceSupers","methodPath","replace","_default","declare","api","assertVersion","name","visitor","ObjectExpression","state","objectRef","scope","generateUidIdentifier","get","forEach","propPath","isMethod","push","id","t","cloneNode","replaceWith","assignmentExpression","node","exports","default"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport { types as t, type File } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\n\nfunction replacePropertySuper(\n path: NodePath<t.ObjectMethod>,\n getObjectRef: () => t.Identifier,\n file: File,\n) {\n // @ts-expect-error todo(flow->ts):\n const replaceSupers = new ReplaceSupers({\n getObjectRef: getObjectRef,\n methodPath: path,\n file: file,\n });\n\n replaceSupers.replace();\n}\n\nexport default declare(api => {\n api.assertVersion(7);\n\n return {\n name: \"transform-object-super\",\n\n visitor: {\n ObjectExpression(path, state) {\n let objectRef: t.Identifier;\n const getObjectRef = () =>\n (objectRef = objectRef || path.scope.generateUidIdentifier(\"obj\"));\n\n path.get(\"properties\").forEach(propPath => {\n if (!propPath.isMethod()) return;\n\n replacePropertySuper(propPath, getObjectRef, state.file);\n });\n\n if (objectRef) {\n path.scope.push({ id: t.cloneNode(objectRef) });\n path.replaceWith(\n t.assignmentExpression(\"=\", t.cloneNode(objectRef), path.node),\n );\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,SAASG,oBAAoBA,CAC3BC,IAA8B,EAC9BC,YAAgC,EAChCC,IAAU,EACV;EAEA,MAAMC,aAAa,GAAG,IAAIC,4BAA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