hexo/node_modules/@babel/preset-env/lib/polyfills/regenerator.js.map

1 line
3.0 KiB
Plaintext

{"version":3,"names":["_utils","require","isRegeneratorSource","source","_default","visitor","ImportDeclaration","path","getImportSource","regeneratorImportExcluded","remove","Program","get","forEach","bodyPath","getRequireSource","name","pre","post","opts","debug","filename","file","process","env","BABEL_ENV","replace","console","log"],"sources":["../../src/polyfills/regenerator.ts"],"sourcesContent":["import { getImportSource, getRequireSource } from \"./utils\";\nimport type { Visitor } from \"@babel/traverse\";\nimport type { PluginObject, PluginPass } from \"@babel/core\";\n\nfunction isRegeneratorSource(source: string) {\n return (\n source === \"regenerator-runtime/runtime\" ||\n source === \"regenerator-runtime/runtime.js\"\n );\n}\n\ntype State = {\n regeneratorImportExcluded: boolean;\n};\n\nexport default function (): PluginObject<State & PluginPass> {\n const visitor: Visitor<State & PluginPass> = {\n ImportDeclaration(path) {\n if (isRegeneratorSource(getImportSource(path))) {\n this.regeneratorImportExcluded = true;\n path.remove();\n }\n },\n Program(path) {\n path.get(\"body\").forEach(bodyPath => {\n if (isRegeneratorSource(getRequireSource(bodyPath))) {\n this.regeneratorImportExcluded = true;\n bodyPath.remove();\n }\n });\n },\n };\n\n return {\n name: \"preset-env/remove-regenerator\",\n visitor,\n pre() {\n this.regeneratorImportExcluded = false;\n },\n post() {\n if (this.opts.debug && this.regeneratorImportExcluded) {\n let filename = this.file.opts.filename;\n // normalize filename to generate consistent preset-env test fixtures\n if (process.env.BABEL_ENV === \"test\") {\n filename = filename.replace(/\\\\/g, \"/\");\n }\n console.log(\n `\\n[${filename}] Based on your targets, regenerator-runtime import excluded.`,\n );\n }\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,SAASC,mBAAmBA,CAACC,MAAc,EAAE;EAC3C,OACEA,MAAM,KAAK,6BAA6B,IACxCA,MAAM,KAAK,gCAAgC;AAE/C;AAMe,SAAAC,SAAA,EAA8C;EAC3D,MAAMC,OAAoC,GAAG;IAC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