source: imaps-frontend/node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.lazyImportsHook = void 0;
7var _core = require("@babel/core");
8var _helperModuleTransforms = require("@babel/helper-module-transforms");
9const lazyImportsHook = lazy => ({
10 name: `${"@babel/plugin-transform-modules-commonjs"}/lazy`,
11 version: "7.26.3",
12 getWrapperPayload(source, metadata) {
13 if ((0, _helperModuleTransforms.isSideEffectImport)(metadata) || metadata.reexportAll) {
14 return null;
15 }
16 if (lazy === true) {
17 return source.includes(".") ? null : "lazy/function";
18 }
19 if (Array.isArray(lazy)) {
20 return !lazy.includes(source) ? null : "lazy/function";
21 }
22 if (typeof lazy === "function") {
23 return lazy(source) ? "lazy/function" : null;
24 }
25 },
26 buildRequireWrapper(name, init, payload, referenced) {
27 if (payload === "lazy/function") {
28 if (!referenced) return false;
29 return _core.template.statement.ast`
30 function ${name}() {
31 const data = ${init};
32 ${name} = function(){ return data; };
33 return data;
34 }
35 `;
36 }
37 },
38 wrapReference(ref, payload) {
39 if (payload === "lazy/function") return _core.types.callExpression(ref, []);
40 }
41});
42exports.lazyImportsHook = lazyImportsHook;
43
44//# sourceMappingURL=lazy.js.map
Note: See TracBrowser for help on using the repository browser.