@lwrjs/shared-utils 0.24.1 → 0.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/bundle.cjs +24 -20
- package/build/cjs/compiler.cjs +22 -25
- package/build/cjs/cookie.cjs +27 -11
- package/build/cjs/env.cjs +40 -12
- package/build/cjs/fs.cjs +50 -40
- package/build/cjs/graph.cjs +78 -38
- package/build/cjs/headers.cjs +17 -4
- package/build/cjs/html-meta.cjs +56 -38
- package/build/cjs/identity.cjs +34 -23
- package/build/cjs/import-metadata.cjs +25 -25
- package/build/cjs/index.cjs +33 -35
- package/build/cjs/interchangeable-modules.cjs +46 -33
- package/build/cjs/launch.cjs +24 -17
- package/build/cjs/link.cjs +23 -16
- package/build/cjs/localization.cjs +24 -17
- package/build/cjs/lwr-app-observer.cjs +15 -18
- package/build/cjs/mappings.cjs +76 -37
- package/build/cjs/mrt-utils.cjs +15 -18
- package/build/cjs/object.cjs +24 -8
- package/build/cjs/serialize.cjs +53 -37
- package/build/cjs/tasks.cjs +33 -5
- package/build/cjs/urls.cjs +34 -22
- package/package.json +4 -4
package/build/cjs/launch.cjs
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
8
|
var __export = (target, all) => {
|
|
9
9
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
17
|
}
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
var __toModule = (module2) => {
|
|
21
|
-
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
18
|
+
return to;
|
|
22
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
29
|
|
|
24
30
|
// packages/@lwrjs/shared-utils/src/launch.ts
|
|
25
|
-
|
|
26
|
-
__export(
|
|
31
|
+
var launch_exports = {};
|
|
32
|
+
__export(launch_exports, {
|
|
27
33
|
launch: () => launch
|
|
28
34
|
});
|
|
29
|
-
|
|
35
|
+
module.exports = __toCommonJS(launch_exports);
|
|
36
|
+
var import_os = require("os");
|
|
30
37
|
async function launch(port, https, path) {
|
|
31
|
-
const {exec} = await
|
|
38
|
+
const { exec } = await import("child_process");
|
|
32
39
|
let cmd = "open";
|
|
33
40
|
if (process.platform == "win32") {
|
|
34
41
|
cmd = "start";
|
package/build/cjs/link.cjs
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
8
|
var __export = (target, all) => {
|
|
9
9
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
17
|
}
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
var __toModule = (module2) => {
|
|
21
|
-
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
18
|
+
return to;
|
|
22
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
29
|
|
|
24
30
|
// packages/@lwrjs/shared-utils/src/link.ts
|
|
25
|
-
|
|
26
|
-
__export(
|
|
31
|
+
var link_exports = {};
|
|
32
|
+
__export(link_exports, {
|
|
27
33
|
createStringBuilder: () => createStringBuilder
|
|
28
34
|
});
|
|
29
|
-
|
|
35
|
+
module.exports = __toCommonJS(link_exports);
|
|
36
|
+
var import_magic_string = __toESM(require("magic-string"), 1);
|
|
30
37
|
function createStringBuilder(source) {
|
|
31
38
|
return new import_magic_string.default(source);
|
|
32
39
|
}
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
6
|
var __export = (target, all) => {
|
|
4
7
|
for (var name in all)
|
|
5
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
9
|
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
7
19
|
|
|
8
20
|
// packages/@lwrjs/shared-utils/src/localization.ts
|
|
9
|
-
|
|
10
|
-
__export(
|
|
21
|
+
var localization_exports = {};
|
|
22
|
+
__export(localization_exports, {
|
|
11
23
|
getFallbackLocale: () => getFallbackLocale,
|
|
12
24
|
sortLocalesByFallback: () => sortLocalesByFallback,
|
|
13
25
|
walkLocaleFallbacks: () => walkLocaleFallbacks
|
|
14
26
|
});
|
|
27
|
+
module.exports = __toCommonJS(localization_exports);
|
|
15
28
|
function getFallbackLocale(localeId, i18n) {
|
|
16
29
|
const locale = i18n.locales.find((l) => l.id === localeId);
|
|
17
30
|
return locale?.fallback;
|
|
18
31
|
}
|
|
19
32
|
async function walkLocaleFallbacks(initialLocale, i18n, test) {
|
|
20
|
-
const visited = new Set();
|
|
33
|
+
const visited = /* @__PURE__ */ new Set();
|
|
21
34
|
let localeId = initialLocale;
|
|
22
35
|
while (localeId && !visited.has(localeId)) {
|
|
23
36
|
const result = await test(localeId);
|
|
@@ -36,18 +49,12 @@ async function walkLocaleFallbacks(initialLocale, i18n, test) {
|
|
|
36
49
|
function sortLocalesByFallback(i18n) {
|
|
37
50
|
const sortedLocales = [...i18n.locales];
|
|
38
51
|
return sortedLocales.sort((a, b) => {
|
|
39
|
-
if (a.id === i18n.defaultLocale)
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
if (a.fallback &&
|
|
44
|
-
|
|
45
|
-
if (b.fallback && !a.fallback)
|
|
46
|
-
return -1;
|
|
47
|
-
if (a.fallback && b.id === a.fallback)
|
|
48
|
-
return 1;
|
|
49
|
-
if (b.fallback && a.id === b.fallback)
|
|
50
|
-
return -1;
|
|
52
|
+
if (a.id === i18n.defaultLocale) return -1;
|
|
53
|
+
if (b.id === i18n.defaultLocale) return 1;
|
|
54
|
+
if (a.fallback && !b.fallback) return 1;
|
|
55
|
+
if (b.fallback && !a.fallback) return -1;
|
|
56
|
+
if (a.fallback && b.id === a.fallback) return 1;
|
|
57
|
+
if (b.fallback && a.id === b.fallback) return -1;
|
|
51
58
|
return 0;
|
|
52
59
|
});
|
|
53
60
|
}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
9
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
15
|
}
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
var __toModule = (module2) => {
|
|
21
|
-
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
16
|
+
return to;
|
|
22
17
|
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
|
|
24
20
|
// packages/@lwrjs/shared-utils/src/lwr-app-observer.ts
|
|
25
|
-
|
|
26
|
-
__export(
|
|
21
|
+
var lwr_app_observer_exports = {};
|
|
22
|
+
__export(lwr_app_observer_exports, {
|
|
27
23
|
LwrApplicationObserver: () => LwrApplicationObserver
|
|
28
24
|
});
|
|
29
|
-
|
|
25
|
+
module.exports = __toCommonJS(lwr_app_observer_exports);
|
|
26
|
+
var import_events = require("events");
|
|
30
27
|
var MODULE_DEF_CHANGED_EVENT = "module_definition_changed";
|
|
31
28
|
var MODULE_SOURCE_CHANGED_EVENT = "module_source_changed";
|
|
32
29
|
var VIEW_SOURCE_CHANGED_EVENT = "view_source_changed";
|
package/build/cjs/mappings.cjs
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
9
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
15
|
}
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
var __toModule = (module2) => {
|
|
21
|
-
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
16
|
+
return to;
|
|
22
17
|
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
|
|
24
20
|
// packages/@lwrjs/shared-utils/src/mappings.ts
|
|
25
|
-
|
|
26
|
-
__export(
|
|
21
|
+
var mappings_exports = {};
|
|
22
|
+
__export(mappings_exports, {
|
|
27
23
|
getImportMetadataMappings: () => getImportMetadataMappings,
|
|
28
24
|
isExternalFileSpecifier: () => isExternalFileSpecifier,
|
|
29
25
|
isExternalSpecifier: () => isExternalSpecifier,
|
|
30
26
|
toImportMetadata: () => toImportMetadata
|
|
31
27
|
});
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
var
|
|
28
|
+
module.exports = __toCommonJS(mappings_exports);
|
|
29
|
+
var import_graph = require("./graph.cjs");
|
|
30
|
+
var import_identity = require("./identity.cjs");
|
|
31
|
+
var import_fs = require("./fs.cjs");
|
|
35
32
|
async function getImportMetadataMappings(moduleIds, runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler) {
|
|
36
|
-
const visitedCache = new Map();
|
|
33
|
+
const visitedCache = /* @__PURE__ */ new Map();
|
|
37
34
|
let importMetadata = {
|
|
38
35
|
imports: {},
|
|
39
36
|
index: {}
|
|
@@ -46,21 +43,40 @@ async function getImportMetadataMappings(moduleIds, runtimeEnvironment, runtimeP
|
|
|
46
43
|
static: runtimeEnvironment.format === "esm" ? import_graph.GraphDepth.NONE : import_graph.GraphDepth.ALL,
|
|
47
44
|
dynamic: runtimeEnvironment.format === "esm" ? 1 : 0
|
|
48
45
|
};
|
|
49
|
-
const moduleGraph = await (0, import_graph.getModuleGraphs)(
|
|
50
|
-
|
|
46
|
+
const moduleGraph = await (0, import_graph.getModuleGraphs)(
|
|
47
|
+
specifier,
|
|
48
|
+
// include uris and linked definitions
|
|
49
|
+
{ includeUris: true, includeLinkedDefinitions: true, depth },
|
|
50
|
+
moduleRegistry,
|
|
51
|
+
runtimeEnvironment.bundle ? moduleBundler : moduleRegistry,
|
|
52
|
+
runtimeEnvironment,
|
|
53
|
+
runtimeParams,
|
|
54
|
+
visitedCache
|
|
55
|
+
);
|
|
56
|
+
importMetadata = await toImportMetadata(
|
|
57
|
+
moduleGraph,
|
|
58
|
+
importMetadata,
|
|
59
|
+
moduleRegistry,
|
|
60
|
+
runtimeEnvironment,
|
|
61
|
+
runtimeParams
|
|
62
|
+
);
|
|
51
63
|
}
|
|
52
64
|
if (moduleId.importer && requestedSpecifier !== specifier) {
|
|
53
65
|
const requestedSpecifierPlusImporter = `${requestedSpecifier}?importer=${moduleId.importer}`;
|
|
54
|
-
const specifiersArray = Object.values(importMetadata.imports).find(
|
|
66
|
+
const specifiersArray = Object.values(importMetadata.imports).find(
|
|
67
|
+
(a) => a.includes(specifier)
|
|
68
|
+
);
|
|
55
69
|
if (!specifiersArray) {
|
|
56
|
-
throw new Error(
|
|
70
|
+
throw new Error(
|
|
71
|
+
"Could not find: " + specifier + " in " + JSON.stringify(importMetadata.imports)
|
|
72
|
+
);
|
|
57
73
|
}
|
|
58
74
|
specifiersArray.push(requestedSpecifierPlusImporter);
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
77
|
return importMetadata;
|
|
62
78
|
}
|
|
63
|
-
async function toImportMetadata(moduleGraph, existingImportMetadata = {imports: {}, index: {}}, moduleRegistry, runtimeEnvironment, runtimeParams = {}) {
|
|
79
|
+
async function toImportMetadata(moduleGraph, existingImportMetadata = { imports: {}, index: {} }, moduleRegistry, runtimeEnvironment, runtimeParams = {}) {
|
|
64
80
|
const specifier = moduleGraph.graphs[0].specifier;
|
|
65
81
|
const uri = lookupValueIgnoringVersion(moduleGraph.uriMap, specifier);
|
|
66
82
|
const definition = lookupValueIgnoringVersion(moduleGraph.linkedDefinitions, specifier);
|
|
@@ -71,12 +87,19 @@ async function toImportMetadata(moduleGraph, existingImportMetadata = {imports:
|
|
|
71
87
|
throw new Error("Linked module definition was not included in the graph: " + specifier);
|
|
72
88
|
}
|
|
73
89
|
if (isExternalSpecifier(specifier, moduleRegistry.getConfig().bundleConfig)) {
|
|
74
|
-
const externalMapping = {imports: {}, index: {}};
|
|
90
|
+
const externalMapping = { imports: {}, index: {} };
|
|
75
91
|
externalMapping.imports[uri] = [specifier];
|
|
76
92
|
externalMapping.index[specifier] = uri;
|
|
77
93
|
return externalMapping;
|
|
78
94
|
}
|
|
79
|
-
const rootMetadata = await normalizeImportMetadata(
|
|
95
|
+
const rootMetadata = await normalizeImportMetadata(
|
|
96
|
+
specifier,
|
|
97
|
+
uri,
|
|
98
|
+
definition,
|
|
99
|
+
moduleRegistry,
|
|
100
|
+
runtimeEnvironment,
|
|
101
|
+
runtimeParams
|
|
102
|
+
);
|
|
80
103
|
let importMetadata = mergeImportMetadata(existingImportMetadata, rootMetadata);
|
|
81
104
|
const depSpecifiers = runtimeEnvironment.format === "esm" ? moduleGraph.graphs[0].dynamicRefs : moduleGraph.graphs[0].static;
|
|
82
105
|
for (const depSpecifier of depSpecifiers) {
|
|
@@ -91,7 +114,9 @@ async function toImportMetadata(moduleGraph, existingImportMetadata = {imports:
|
|
|
91
114
|
throw new Error("URI was not included in the graph for dependent: " + depSpecifier);
|
|
92
115
|
}
|
|
93
116
|
if (!depDef) {
|
|
94
|
-
throw new Error(
|
|
117
|
+
throw new Error(
|
|
118
|
+
"Linked dependent module definition was not included in the graph: " + depSpecifier
|
|
119
|
+
);
|
|
95
120
|
}
|
|
96
121
|
} else if (depMissing) {
|
|
97
122
|
continue;
|
|
@@ -99,7 +124,14 @@ async function toImportMetadata(moduleGraph, existingImportMetadata = {imports:
|
|
|
99
124
|
if (!importMetadata.imports[depUri]) {
|
|
100
125
|
const depDefSpecifier = (0, import_identity.getSpecifier)(depDef);
|
|
101
126
|
if (!isExternalSpecifier(depDefSpecifier, moduleRegistry.getConfig().bundleConfig)) {
|
|
102
|
-
const depMetadata = await normalizeImportMetadata(
|
|
127
|
+
const depMetadata = await normalizeImportMetadata(
|
|
128
|
+
depDefSpecifier,
|
|
129
|
+
depUri,
|
|
130
|
+
depDef,
|
|
131
|
+
moduleRegistry,
|
|
132
|
+
runtimeEnvironment,
|
|
133
|
+
runtimeParams
|
|
134
|
+
);
|
|
103
135
|
importMetadata = mergeImportMetadata(importMetadata, depMetadata);
|
|
104
136
|
}
|
|
105
137
|
}
|
|
@@ -148,10 +180,14 @@ function normalizedIncludedModules(definition) {
|
|
|
148
180
|
}
|
|
149
181
|
async function createIndex(specifiers, moduleRegistry, runtimeEnvironment, runtimeParams) {
|
|
150
182
|
const index = {};
|
|
151
|
-
const moduleRuntimeEnvironment = {...runtimeEnvironment, bundle: false};
|
|
183
|
+
const moduleRuntimeEnvironment = { ...runtimeEnvironment, bundle: false };
|
|
152
184
|
async function getUri(specifier) {
|
|
153
185
|
const moduleId = (0, import_identity.explodeSpecifier)(specifier);
|
|
154
|
-
index[specifier] = await moduleRegistry.resolveModuleUri(
|
|
186
|
+
index[specifier] = await moduleRegistry.resolveModuleUri(
|
|
187
|
+
{ ...moduleId, version: moduleId.version || import_identity.VERSION_NOT_PROVIDED },
|
|
188
|
+
moduleRuntimeEnvironment,
|
|
189
|
+
runtimeParams
|
|
190
|
+
);
|
|
155
191
|
}
|
|
156
192
|
const promises = [];
|
|
157
193
|
for (const specifier of specifiers) {
|
|
@@ -166,16 +202,19 @@ async function getVersionedSpecifier(moduleId, moduleRegistry, runtimeParams) {
|
|
|
166
202
|
if (moduleId.version) {
|
|
167
203
|
return (0, import_identity.getSpecifier)(moduleId);
|
|
168
204
|
}
|
|
169
|
-
const versionedModuleEntry = await moduleRegistry.getModuleEntry(
|
|
170
|
-
|
|
171
|
-
|
|
205
|
+
const versionedModuleEntry = await moduleRegistry.getModuleEntry(
|
|
206
|
+
{
|
|
207
|
+
...moduleId
|
|
208
|
+
},
|
|
209
|
+
runtimeParams
|
|
210
|
+
);
|
|
172
211
|
return (0, import_identity.getSpecifier)(versionedModuleEntry);
|
|
173
212
|
}
|
|
174
213
|
function isExternalSpecifier(id, bundleConfig) {
|
|
175
|
-
const {specifier} = (0, import_identity.explodeSpecifier)(id);
|
|
214
|
+
const { specifier } = (0, import_identity.explodeSpecifier)(id);
|
|
176
215
|
return !!(bundleConfig?.external && Object.prototype.hasOwnProperty.call(bundleConfig.external, specifier));
|
|
177
216
|
}
|
|
178
217
|
function isExternalFileSpecifier(id, bundleConfig) {
|
|
179
|
-
const {specifier} = (0, import_identity.explodeSpecifier)(id);
|
|
218
|
+
const { specifier } = (0, import_identity.explodeSpecifier)(id);
|
|
180
219
|
return !!(bundleConfig?.external && bundleConfig.external[specifier] && bundleConfig.external[specifier].startsWith(import_fs.PROTOCOL_FILE));
|
|
181
220
|
}
|
package/build/cjs/mrt-utils.cjs
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
9
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
15
|
}
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
var __toModule = (module2) => {
|
|
21
|
-
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
16
|
+
return to;
|
|
22
17
|
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
|
|
24
20
|
// packages/@lwrjs/shared-utils/src/mrt-utils.ts
|
|
25
|
-
|
|
26
|
-
__export(
|
|
21
|
+
var mrt_utils_exports = {};
|
|
22
|
+
__export(mrt_utils_exports, {
|
|
27
23
|
getMrtArtifactUrl: () => getMrtArtifactUrl,
|
|
28
24
|
getMrtSsgRoot: () => getMrtSsgRoot,
|
|
29
25
|
getSsgAppRelativePath: () => getSsgAppRelativePath
|
|
30
26
|
});
|
|
31
|
-
|
|
27
|
+
module.exports = __toCommonJS(mrt_utils_exports);
|
|
28
|
+
var import_fs = require("./fs.cjs");
|
|
32
29
|
var MRT_BASE_URL = `/mobify/bundle/${process.env.BUNDLE_ID || "development"}/`;
|
|
33
30
|
var DEFAULT_SSG_ROOT = "site";
|
|
34
31
|
function getSsgAppRelativePath(staticSiteGenerator) {
|
package/build/cjs/object.cjs
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
6
|
var __export = (target, all) => {
|
|
4
7
|
for (var name in all)
|
|
5
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
9
|
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
7
19
|
|
|
8
20
|
// packages/@lwrjs/shared-utils/src/object.ts
|
|
9
|
-
|
|
10
|
-
__export(
|
|
21
|
+
var object_exports = {};
|
|
22
|
+
__export(object_exports, {
|
|
11
23
|
debounce: () => debounce,
|
|
12
24
|
deepFreeze: () => deepFreeze
|
|
13
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(object_exports);
|
|
14
27
|
function _deepFreeze(obj, maxDepth, depth) {
|
|
15
28
|
if (depth < maxDepth) {
|
|
16
29
|
Object.keys(obj).forEach((prop) => {
|
|
@@ -30,14 +43,17 @@ function deepFreeze(obj, maxDepth = 5) {
|
|
|
30
43
|
return _deepFreeze(objClone, maxDepth, 0);
|
|
31
44
|
}
|
|
32
45
|
var debounce = (func, waitFor) => {
|
|
33
|
-
const timeouts = new Map();
|
|
46
|
+
const timeouts = /* @__PURE__ */ new Map();
|
|
34
47
|
const debounced = (...args) => {
|
|
35
48
|
const firstArg = args[0];
|
|
36
49
|
if (!timeouts.has(firstArg)) {
|
|
37
50
|
func(...args);
|
|
38
|
-
timeouts.set(
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
timeouts.set(
|
|
52
|
+
args[0],
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
timeouts.delete(firstArg);
|
|
55
|
+
}, waitFor)
|
|
56
|
+
);
|
|
41
57
|
}
|
|
42
58
|
};
|
|
43
59
|
return debounced;
|