Sha256: 40965061edec4c284b9657ee1e71849987842df21fd5ee04ec8f0076c5091245

Contents?: true

Size: 1.3 KB

Versions: 21

Compression:

Stored size: 1.3 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.lazyImportsHook = void 0;
var _core = require("@babel/core");
var _helperModuleTransforms = require("@babel/helper-module-transforms");
const lazyImportsHook = lazy => ({
  name: `${"@babel/plugin-transform-modules-commonjs"}/lazy`,
  version: "7.24.7",
  getWrapperPayload(source, metadata) {
    if ((0, _helperModuleTransforms.isSideEffectImport)(metadata) || metadata.reexportAll) {
      return null;
    }
    if (lazy === true) {
      return /\./.test(source) ? null : "lazy/function";
    }
    if (Array.isArray(lazy)) {
      return lazy.indexOf(source) === -1 ? null : "lazy/function";
    }
    if (typeof lazy === "function") {
      return lazy(source) ? "lazy/function" : null;
    }
  },
  buildRequireWrapper(name, init, payload, referenced) {
    if (payload === "lazy/function") {
      if (!referenced) return false;
      return _core.template.statement.ast`
        function ${name}() {
          const data = ${init};
          ${name} = function(){ return data; };
          return data;
        }
      `;
    }
  },
  wrapReference(ref, payload) {
    if (payload === "lazy/function") return _core.types.callExpression(ref, []);
  }
});
exports.lazyImportsHook = lazyImportsHook;

//# sourceMappingURL=lazy.js.map

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.59 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.58 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.57 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.56 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.55 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.54 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.53 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.52 node_modules/@babel/preset-typescript/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.47 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.44 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.43 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.42 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js
immosquare-cleaner-0.1.41 node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js