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