hexo/node_modules/@babel/plugin-transform-async-to-g.../lib/index.js.map

1 line
3.2 KiB
Plaintext

{"version":3,"names":["declare","api","options","assertVersion","method","module","noNewArrows","assumption","ignoreFunctionLength","name","visitor","Function","path","state","node","async","generator","wrapAsync","methodWrapper","t","cloneNode","addNamed","remapAsyncToGenerator","addHelper"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport remapAsyncToGenerator from \"@babel/helper-remap-async-to-generator\";\nimport { addNamed } from \"@babel/helper-module-imports\";\nimport { types as t } from \"@babel/core\";\n\nexport interface Options {\n method?: string;\n module?: string;\n}\n\ntype State = {\n methodWrapper?: t.Identifier | t.SequenceExpression;\n};\n\nexport default declare<State>((api, options: Options) => {\n api.assertVersion(7);\n\n const { method, module } = options;\n // Todo(BABEL 8): Consider default it to false\n const noNewArrows = api.assumption(\"noNewArrows\") ?? true;\n const ignoreFunctionLength = api.assumption(\"ignoreFunctionLength\") ?? false;\n\n if (method && module) {\n return {\n name: \"transform-async-to-generator\",\n\n visitor: {\n Function(path, state) {\n if (!path.node.async || path.node.generator) return;\n\n let wrapAsync = state.methodWrapper;\n if (wrapAsync) {\n wrapAsync = t.cloneNode(wrapAsync);\n } else {\n wrapAsync = state.methodWrapper = addNamed(path, method, module);\n }\n\n remapAsyncToGenerator(\n path,\n { wrapAsync },\n noNewArrows,\n ignoreFunctionLength,\n );\n },\n },\n };\n }\n\n return {\n name: \"transform-async-to-generator\",\n\n visitor: {\n Function(path, state) {\n if (!path.node.async || path.node.generator) return;\n\n remapAsyncToGenerator(\n path,\n { wrapAsync: state.addHelper(\"asyncToGenerator\") },\n noNewArrows,\n ignoreFunctionLength,\n );\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAAyC,eAW1B,IAAAA,0BAAO,EAAQ,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAAA;EACvDD,GAAG,CAACE,aAAa,CAAC,CAAC,CAAC;EAEpB,MAAM;IA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