Sha256: 6d9d106938d4a65935b34940be10e5fea037a4e15ec797049b83c242cfb6cc24

Contents?: true

Size: 1.82 KB

Versions: 16

Compression:

Stored size: 1.82 KB

Contents

{"version":3,"names":["_core","require","_helperModuleTransforms","requireNoInterop","source","template","expression","ast","requireInterop","file","t","callExpression","addHelper","transformDynamicImport","path","noInterop","buildRequire","replaceWith","buildDynamicImport","node","specifier"],"sources":["../src/dynamic-import.ts"],"sourcesContent":["// Heavily inspired by\n// https://github.com/airbnb/babel-plugin-dynamic-import-node/blob/master/src/utils.js\n\nimport type { File, NodePath } from \"@babel/core\";\nimport { types as t, template } from \"@babel/core\";\nimport { buildDynamicImport } from \"@babel/helper-module-transforms\";\n\nconst requireNoInterop = (source: t.Expression) =>\n  template.expression.ast`require(${source})`;\n\nconst requireInterop = (source: t.Expression, file: File) =>\n  t.callExpression(file.addHelper(\"interopRequireWildcard\"), [\n    requireNoInterop(source),\n  ]);\n\nexport function transformDynamicImport(\n  path: NodePath<t.CallExpression | t.ImportExpression>,\n  noInterop: boolean,\n  file: File,\n) {\n  const buildRequire = noInterop ? requireNoInterop : requireInterop;\n\n  path.replaceWith(\n    buildDynamicImport(path.node, true, false, specifier =>\n      buildRequire(specifier, file),\n    ),\n  );\n}\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,MAAME,gBAAgB,GAAIC,MAAoB,IAC5CC,cAAQ,CAACC,UAAU,CAACC,GAAI,WAAUH,MAAO,GAAE;AAE7C,MAAMI,cAAc,GAAGA,CAACJ,MAAoB,EAAEK,IAAU,KACtDC,WAAC,CAACC,cAAc,CAACF,IAAI,CAACG,SAAS,CAAC,wBAAwB,CAAC,EAAE,CACzDT,gBAAgB,CAACC,MAAM,CAAC,CACzB,CAAC;AAEG,SAASS,sBAAsBA,CACpCC,IAAqD,EACrDC,SAAkB,EAClBN,IAAU,EACV;EACA,MAAMO,YAAY,GAAGD,SAAS,GAAGZ,gBAAgB,GAAGK,cAAc;EAElEM,IAAI,CAACG,WAAW,CACd,IAAAC,0CAAkB,EAACJ,IAAI,CAACK,IAAI,EAAE,IAAI,EAAE,KAAK,EAAEC,SAAS,IAClDJ,YAAY,CAACI,SAAS,EAAEX,IAAI,CAC9B,CACF,CAAC;AACH","ignoreList":[]}

Version data entries

16 entries across 12 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.49 node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.47 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.44 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.43 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.42 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.41 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
immosquare-cleaner-0.1.40 node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map