source: imaps-frontend/node_modules/@babel/helper-module-transforms/lib/lazy-modules.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1005 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.toGetWrapperPayload = toGetWrapperPayload;
7exports.wrapReference = wrapReference;
8var _core = require("@babel/core");
9var _normalizeAndLoadMetadata = require("./normalize-and-load-metadata.js");
10function toGetWrapperPayload(lazy) {
11 return (source, metadata) => {
12 if (lazy === false) return null;
13 if ((0, _normalizeAndLoadMetadata.isSideEffectImport)(metadata) || metadata.reexportAll) return null;
14 if (lazy === true) {
15 return source.includes(".") ? null : "lazy";
16 }
17 if (Array.isArray(lazy)) {
18 return !lazy.includes(source) ? null : "lazy";
19 }
20 if (typeof lazy === "function") {
21 return lazy(source) ? "lazy" : null;
22 }
23 throw new Error(`.lazy must be a boolean, string array, or function`);
24 };
25}
26function wrapReference(ref, payload) {
27 if (payload === "lazy") return _core.types.callExpression(ref, []);
28 return null;
29}
30
31//# sourceMappingURL=lazy-modules.js.map
Note: See TracBrowser for help on using the repository browser.