main
Last change
on this file 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 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.toGetWrapperPayload = toGetWrapperPayload;
|
---|
7 | exports.wrapReference = wrapReference;
|
---|
8 | var _core = require("@babel/core");
|
---|
9 | var _normalizeAndLoadMetadata = require("./normalize-and-load-metadata.js");
|
---|
10 | function 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 | }
|
---|
26 | function 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.