index.mjs 963 B

123456789101112131415161718192021222324252627282930313233343536
  1. import defineProvider from '@babel/helper-define-polyfill-provider';
  2. const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
  3. var index = defineProvider(({
  4. debug
  5. }, options) => {
  6. const {
  7. [runtimeCompat]: {
  8. useBabelRuntime
  9. } = {}
  10. } = options;
  11. const pureName = useBabelRuntime ? `${useBabelRuntime}/regenerator` : "regenerator-runtime";
  12. return {
  13. name: "regenerator",
  14. polyfills: ["regenerator-runtime"],
  15. usageGlobal(meta, utils) {
  16. if (isRegenerator(meta)) {
  17. debug("regenerator-runtime");
  18. utils.injectGlobalImport("regenerator-runtime/runtime.js");
  19. }
  20. },
  21. usagePure(meta, utils, path) {
  22. if (isRegenerator(meta)) {
  23. path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
  24. }
  25. }
  26. };
  27. });
  28. const isRegenerator = meta => meta.kind === "global" && meta.name === "regeneratorRuntime";
  29. export default index;
  30. //# sourceMappingURL=index.mjs.map