@lwrjs/shared-utils 0.6.0-alpha.2 → 0.6.0-alpha.6
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/env.cjs +3 -3
- package/build/cjs/fs.cjs +11 -11
- package/build/cjs/graph.cjs +11 -11
- package/build/cjs/html-meta.cjs +13 -13
- package/build/cjs/identity.cjs +26 -22
- package/build/cjs/import-metadata.cjs +9 -9
- package/build/cjs/index.cjs +21 -20
- package/build/cjs/interchangeable-modules.cjs +9 -9
- package/build/cjs/link.cjs +8 -8
- package/build/cjs/mappings.cjs +14 -14
- package/build/cjs/metrics.cjs +3 -3
- package/build/cjs/object.cjs +3 -3
- package/build/cjs/serialize.cjs +8 -8
- package/build/cjs/tasks.cjs +72 -0
- package/build/cjs/typescript.cjs +11 -11
- package/build/cjs/urls.cjs +10 -10
- package/build/es/identity.d.ts +7 -1
- package/build/es/identity.js +10 -1
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +1 -0
- package/build/es/mappings.d.ts +2 -2
- package/build/es/mappings.js +4 -4
- package/build/es/tasks.d.ts +38 -0
- package/build/es/tasks.js +98 -0
- package/build/es/urls.d.ts +3 -9
- package/package.json +6 -6
package/build/cjs/env.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
3
|
var __export = (target, all) => {
|
|
4
|
-
__markAsModule(target);
|
|
5
4
|
for (var name in all)
|
|
6
|
-
__defProp(target, name, {
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
// packages/@lwrjs/shared-utils/src/env.ts
|
|
9
|
+
__markAsModule(exports);
|
|
10
10
|
__export(exports, {
|
|
11
11
|
getExperimentalFeatures: () => getExperimentalFeatures
|
|
12
12
|
});
|
package/build/cjs/fs.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/fs.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
canResolveView: () => canResolveView,
|
|
28
28
|
createFileWatcher: () => createFileWatcher,
|
|
@@ -70,7 +70,7 @@ function resolveFileExtension(filePath) {
|
|
|
70
70
|
throw new Error(`Unable to find file "${filePath}"`);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function createFileWatcher(options = {
|
|
73
|
+
function createFileWatcher(options = {persistent: true, ignored: "**/node_modules/**"}) {
|
|
74
74
|
return import_chokidar.default.watch([], options);
|
|
75
75
|
}
|
|
76
76
|
function setupWatcher(onModuleChange) {
|
|
@@ -107,13 +107,13 @@ function normalizeDirectory(dir, rootDir) {
|
|
|
107
107
|
return dir.replace(ROOT_DIR_REGEX, rootDir);
|
|
108
108
|
}
|
|
109
109
|
var RESOURCE_DIR_REGEX = /\$(\w+)|^\$(\w+)/g;
|
|
110
|
-
function normalizeResourcePath(rawPath, {
|
|
110
|
+
function normalizeResourcePath(rawPath, {rootDir, assets, contentDir, layoutsDir}, allowUnresolvedAlias) {
|
|
111
111
|
const assetsMap = assets.reduce((map, asset) => {
|
|
112
112
|
if (asset.alias) {
|
|
113
113
|
map[asset.alias] = asset.dir || asset.file;
|
|
114
114
|
}
|
|
115
115
|
return map;
|
|
116
|
-
}, {
|
|
116
|
+
}, {rootDir, contentDir, layoutsDir});
|
|
117
117
|
return rawPath.replace(RESOURCE_DIR_REGEX, function(fullMatch, m1, m2) {
|
|
118
118
|
const alias = assetsMap[m1] || assetsMap[m2];
|
|
119
119
|
if (!alias && !allowUnresolvedAlias) {
|
package/build/cjs/graph.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/graph.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
GraphDepth: () => GraphDepth,
|
|
28
28
|
getModuleGraphs: () => getModuleGraphs
|
|
@@ -39,13 +39,13 @@ function isBundler(registry) {
|
|
|
39
39
|
return registry.getModuleBundle !== void 0;
|
|
40
40
|
}
|
|
41
41
|
async function traverse(module2, depth, flattened, graphIdx, visited, defRegistry, runtimeEnvironment, runtimeParams) {
|
|
42
|
-
const {
|
|
42
|
+
const {includeId: includeIdHook} = depth;
|
|
43
43
|
const versionedSpecifier = (0, import_identity.getSpecifier)(module2);
|
|
44
|
-
const {
|
|
44
|
+
const {imports = [], dynamicImports = []} = (0, import_identity.isBundleDefinition)(module2) ? module2.bundleRecord : module2.moduleRecord;
|
|
45
45
|
const staticImports = imports.map((imp) => (0, import_identity.getSpecifier)(imp));
|
|
46
46
|
const dynamic = dynamicImports.map((imp) => (0, import_identity.getSpecifier)(imp));
|
|
47
47
|
if (!visited.has(versionedSpecifier)) {
|
|
48
|
-
visited.set(versionedSpecifier, {
|
|
48
|
+
visited.set(versionedSpecifier, {static: staticImports, dynamic});
|
|
49
49
|
}
|
|
50
50
|
if (!flattened[graphIdx]) {
|
|
51
51
|
flattened.push({
|
package/build/cjs/html-meta.cjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/html-meta.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
extractMetadataFromHtml: () => extractMetadataFromHtml
|
|
28
28
|
});
|
|
29
29
|
var import_parse5_sax_parser = __toModule(require("parse5-sax-parser"));
|
|
30
30
|
var import_stream = __toModule(require("stream"));
|
|
31
31
|
function parseAssetLocation(htmlSource, tagName, attrLocation) {
|
|
32
|
-
const {
|
|
32
|
+
const {startOffset, endOffset} = attrLocation;
|
|
33
33
|
const srcAttr = htmlSource.substring(startOffset, endOffset);
|
|
34
34
|
const split = srcAttr.indexOf("=");
|
|
35
35
|
const keyAttr = srcAttr.substr(0, split);
|
|
@@ -48,15 +48,15 @@ async function extractMetadataFromHtml(htmlSource) {
|
|
|
48
48
|
const customElements = [];
|
|
49
49
|
const openElements = new Set();
|
|
50
50
|
const assetReferences = [];
|
|
51
|
-
const parser = new import_parse5_sax_parser.default({
|
|
51
|
+
const parser = new import_parse5_sax_parser.default({sourceCodeLocationInfo: true});
|
|
52
52
|
const ceRefStack = [];
|
|
53
53
|
parser.on("startTag", ({
|
|
54
54
|
tagName,
|
|
55
55
|
sourceCodeLocation
|
|
56
56
|
}) => {
|
|
57
57
|
if (tagName.includes("-") && !openElements.has(tagName)) {
|
|
58
|
-
const {
|
|
59
|
-
const ceRef = {
|
|
58
|
+
const {startOffset, endOffset} = sourceCodeLocation;
|
|
59
|
+
const ceRef = {tagName, location: {startOffset, endOffset}};
|
|
60
60
|
openElements.add(tagName);
|
|
61
61
|
if (ceRefStack.length) {
|
|
62
62
|
const last = ceRefStack[ceRefStack.length - 1];
|
|
@@ -92,7 +92,7 @@ async function extractMetadataFromHtml(htmlSource) {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
const inputStream = import_stream.Readable.from(htmlSource);
|
|
95
|
-
inputStream.on("end", () => resolve({
|
|
95
|
+
inputStream.on("end", () => resolve({customElements, assetReferences}));
|
|
96
96
|
inputStream.on("error", (error) => reject(error));
|
|
97
97
|
inputStream.pipe(parser);
|
|
98
98
|
});
|
package/build/cjs/identity.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/identity.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
ASSETS_CACHE_DIR: () => ASSETS_CACHE_DIR,
|
|
28
28
|
DEFAULT_LOCKER_TRUSTED_CMP: () => DEFAULT_LOCKER_TRUSTED_CMP,
|
|
@@ -53,6 +53,7 @@ __export(exports, {
|
|
|
53
53
|
normalizeVersionFromUri: () => normalizeVersionFromUri,
|
|
54
54
|
normalizeVersionToUri: () => normalizeVersionToUri,
|
|
55
55
|
parsePackageSpecifier: () => parsePackageSpecifier,
|
|
56
|
+
prettyModuleUriSuffix: () => prettyModuleUriSuffix,
|
|
56
57
|
slugify: () => slugify
|
|
57
58
|
});
|
|
58
59
|
var import_slugify = __toModule(require("slugify"));
|
|
@@ -83,6 +84,9 @@ function normalizeVersionToUri(version) {
|
|
|
83
84
|
function normalizeVersionFromUri(version) {
|
|
84
85
|
return version.replace(/_/g, ".");
|
|
85
86
|
}
|
|
87
|
+
function prettyModuleUriSuffix(specifier) {
|
|
88
|
+
return `${specifier.replace(/[\/\.\?\#]/g, "_")}`;
|
|
89
|
+
}
|
|
86
90
|
function explodeSpecifier(rawSpecifier) {
|
|
87
91
|
const decodedSpecifier = decodeURIComponent(rawSpecifier);
|
|
88
92
|
const versionMatch = decodedSpecifier.match(/(.+)\/v\/([a-zA-Z0-9-_.]+)$/);
|
|
@@ -107,7 +111,7 @@ function explodeSpecifiers(rawSpecifiers) {
|
|
|
107
111
|
return exploder(rawSpecifier);
|
|
108
112
|
});
|
|
109
113
|
}
|
|
110
|
-
function getSpecifier({
|
|
114
|
+
function getSpecifier({specifier, namespace, name = "", version}) {
|
|
111
115
|
if (specifier) {
|
|
112
116
|
const versionMatch = specifier.match(/(.+)\/v\/[a-zA-Z0-9-_.]+$/);
|
|
113
117
|
specifier = versionMatch ? versionMatch[1] : specifier;
|
|
@@ -117,20 +121,20 @@ function getSpecifier({ specifier, namespace, name = "", version }) {
|
|
|
117
121
|
return version ? `${bareSpecifier}${VERSION_SIGIL}${normalizeVersionToUri(version)}` : bareSpecifier;
|
|
118
122
|
}
|
|
119
123
|
async function getVersionedSpecifier(rawSpecifier, moduleRegistry) {
|
|
120
|
-
const {
|
|
124
|
+
const {specifier, namespace, name, version} = explodeSpecifier(rawSpecifier);
|
|
121
125
|
if (version) {
|
|
122
126
|
return normalizeVersionToUri(rawSpecifier);
|
|
123
127
|
}
|
|
124
|
-
const moduleEntry = await moduleRegistry.getModuleEntry({
|
|
125
|
-
return getSpecifier({
|
|
128
|
+
const moduleEntry = await moduleRegistry.getModuleEntry({specifier});
|
|
129
|
+
return getSpecifier({namespace, name, version: normalizeVersionToUri(moduleEntry.version)});
|
|
126
130
|
}
|
|
127
131
|
async function getVersionedModuleId(rawSpecifier, moduleRegistry) {
|
|
128
|
-
const {
|
|
132
|
+
const {specifier, version} = explodeSpecifier(rawSpecifier);
|
|
129
133
|
if (version) {
|
|
130
|
-
return {
|
|
134
|
+
return {specifier, version: normalizeVersionFromUri(version)};
|
|
131
135
|
}
|
|
132
|
-
const moduleEntry = await moduleRegistry.getModuleEntry({
|
|
133
|
-
return {
|
|
136
|
+
const moduleEntry = await moduleRegistry.getModuleEntry({specifier});
|
|
137
|
+
return {specifier, version: moduleEntry.version};
|
|
134
138
|
}
|
|
135
139
|
var RE_SCOPED = /^(@[^/]+\/[^/@]+)(?:\/([^@]+))?(?:@([\s\S]+))?/;
|
|
136
140
|
var RE_NORMAL = /^([^/@]+)(?:\/([^@]+))?(?:@([\s\S]+))?/;
|
|
@@ -180,7 +184,7 @@ function slugify(name) {
|
|
|
180
184
|
lower: true
|
|
181
185
|
});
|
|
182
186
|
}
|
|
183
|
-
function getModuleUriPrefix({
|
|
187
|
+
function getModuleUriPrefix({apiVersion, bundle, format, compat}, {locale, environment} = {}) {
|
|
184
188
|
const localePart = locale ? `/${LOCALE_SIGIL}/${locale}` : "";
|
|
185
189
|
const environmentPart = environment ? `/${ENVIRONMENT_SIGIL}/${environment}` : "";
|
|
186
190
|
if (bundle) {
|
|
@@ -189,7 +193,7 @@ function getModuleUriPrefix({ apiVersion, bundle, format, compat }, { locale, en
|
|
|
189
193
|
return `/${apiVersion}/module/${format}/${compat}${localePart}${environmentPart}/mi/`;
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
|
-
function getMappingUriPrefix({
|
|
196
|
+
function getMappingUriPrefix({apiVersion, format, compat}, {locale} = {}) {
|
|
193
197
|
const localePart = locale ? `/${LOCALE_SIGIL}/${locale}` : "";
|
|
194
198
|
return `/${apiVersion}/mapping/${format}/${compat}${localePart}/mp/`;
|
|
195
199
|
}
|
|
@@ -201,7 +205,7 @@ function isBundleDefinition(definition) {
|
|
|
201
205
|
return definition.bundleRecord !== void 0;
|
|
202
206
|
}
|
|
203
207
|
function getModuleIdentity(req) {
|
|
204
|
-
const {
|
|
208
|
+
const {specifier, signature = LATEST_SIGNATURE} = req.params;
|
|
205
209
|
const moduleId = explodeSpecifier(specifier);
|
|
206
210
|
return {
|
|
207
211
|
moduleId,
|
|
@@ -209,14 +213,14 @@ function getModuleIdentity(req) {
|
|
|
209
213
|
};
|
|
210
214
|
}
|
|
211
215
|
function getMappingIdentity(req) {
|
|
212
|
-
const {
|
|
216
|
+
const {specifiers} = req.params;
|
|
213
217
|
const moduleIds = explodeSpecifiers(specifiers);
|
|
214
218
|
return {
|
|
215
219
|
moduleIds
|
|
216
220
|
};
|
|
217
221
|
}
|
|
218
222
|
function getResourceIdentity(req) {
|
|
219
|
-
const {
|
|
223
|
+
const {specifier, signature = LATEST_SIGNATURE} = req.params;
|
|
220
224
|
const resourceId = explodeSpecifier(specifier);
|
|
221
225
|
return {
|
|
222
226
|
resourceId,
|
|
@@ -224,7 +228,7 @@ function getResourceIdentity(req) {
|
|
|
224
228
|
};
|
|
225
229
|
}
|
|
226
230
|
function getAssetIdentity(req) {
|
|
227
|
-
const {
|
|
231
|
+
const {signature = LATEST_SIGNATURE, assetType: type} = req.params;
|
|
228
232
|
const [specifier] = req.originalUrl.split("?");
|
|
229
233
|
return {
|
|
230
234
|
assetId: {
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/import-metadata.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
ModuleNameType: () => ModuleNameType,
|
|
28
28
|
getImportMetadata: () => getImportMetadata
|
|
@@ -58,7 +58,7 @@ async function getImportMetadata(compiledSource) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
} else {
|
|
61
|
-
imports.push({
|
|
61
|
+
imports.push({moduleSpecifier, location});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
return {
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __exportStar = (target, module2, desc) => {
|
|
9
9
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
10
|
for (let key of __getOwnPropNames(module2))
|
|
11
11
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
12
|
-
__defProp(target, key, {
|
|
12
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
13
13
|
}
|
|
14
14
|
return target;
|
|
15
15
|
};
|
|
16
16
|
var __toModule = (module2) => {
|
|
17
|
-
return
|
|
17
|
+
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
18
|
};
|
|
19
19
|
|
|
20
20
|
// packages/@lwrjs/shared-utils/src/index.ts
|
|
21
21
|
__markAsModule(exports);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
__exportStar(exports, __toModule(require("./fs.cjs")));
|
|
23
|
+
__exportStar(exports, __toModule(require("./html-meta.cjs")));
|
|
24
|
+
__exportStar(exports, __toModule(require("./identity.cjs")));
|
|
25
|
+
__exportStar(exports, __toModule(require("./interchangeable-modules.cjs")));
|
|
26
|
+
__exportStar(exports, __toModule(require("./link.cjs")));
|
|
27
|
+
__exportStar(exports, __toModule(require("./object.cjs")));
|
|
28
|
+
__exportStar(exports, __toModule(require("./serialize.cjs")));
|
|
29
|
+
__exportStar(exports, __toModule(require("./tasks.cjs")));
|
|
30
|
+
__exportStar(exports, __toModule(require("./typescript.cjs")));
|
|
31
|
+
__exportStar(exports, __toModule(require("./import-metadata.cjs")));
|
|
32
|
+
__exportStar(exports, __toModule(require("./graph.cjs")));
|
|
33
|
+
__exportStar(exports, __toModule(require("./mappings.cjs")));
|
|
34
|
+
__exportStar(exports, __toModule(require("./metrics.cjs")));
|
|
35
|
+
__exportStar(exports, __toModule(require("./urls.cjs")));
|
|
36
|
+
__exportStar(exports, __toModule(require("./env.cjs")));
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/interchangeable-modules.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
discoverInterchangeableModules: () => discoverInterchangeableModules,
|
|
28
28
|
normalizeInterchangeableModuleConfig: () => normalizeInterchangeableModuleConfig,
|
|
@@ -81,7 +81,7 @@ function resolveCustomLWCMetadata(dir) {
|
|
|
81
81
|
if (!metadata.modules) {
|
|
82
82
|
continue;
|
|
83
83
|
}
|
|
84
|
-
const {
|
|
84
|
+
const {interchangeable, interchangeableModules} = metadata;
|
|
85
85
|
return {
|
|
86
86
|
interchangeable,
|
|
87
87
|
interchangeableModules
|
package/build/cjs/link.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/link.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
createStringBuilder: () => createStringBuilder
|
|
28
28
|
});
|
package/build/cjs/mappings.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/mappings.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
getImportMetadataMappings: () => getImportMetadataMappings,
|
|
28
28
|
toImportMetadata: () => toImportMetadata
|
|
@@ -36,16 +36,16 @@ async function getImportMetadataMappings(moduleIds, runtimeEnvironment, runtimeP
|
|
|
36
36
|
index: {}
|
|
37
37
|
};
|
|
38
38
|
for (const moduleId of moduleIds) {
|
|
39
|
-
const specifier = moduleId
|
|
39
|
+
const specifier = (0, import_identity.getSpecifier)(moduleId);
|
|
40
40
|
if (!visitedCache.has(specifier)) {
|
|
41
|
-
const depth = {
|
|
42
|
-
const moduleGraph = await (0, import_graph.getModuleGraphs)(
|
|
41
|
+
const depth = {static: import_graph.GraphDepth.ALL, dynamic: 0};
|
|
42
|
+
const moduleGraph = await (0, import_graph.getModuleGraphs)(specifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, runtimeEnvironment.bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams, visitedCache);
|
|
43
43
|
importMetadata = await toImportMetadata(moduleGraph, importMetadata, moduleRegistry, runtimeEnvironment, runtimeParams);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
return importMetadata;
|
|
47
47
|
}
|
|
48
|
-
async function toImportMetadata(moduleGraph, existingImportMetadata = {
|
|
48
|
+
async function toImportMetadata(moduleGraph, existingImportMetadata = {imports: {}, index: {}}, moduleRegistry, runtimeEnvironment, runtimeParams = {}) {
|
|
49
49
|
const specifier = moduleGraph.graphs[0].specifier;
|
|
50
50
|
const uri = moduleGraph.uriMap[specifier];
|
|
51
51
|
const definition = moduleGraph.linkedDefinitions[specifier];
|
|
@@ -104,13 +104,13 @@ function normalizedIncludedModules(definition) {
|
|
|
104
104
|
}
|
|
105
105
|
async function createIndex(specifiers, moduleRegistry, runtimeEnvironment, runtimeParams) {
|
|
106
106
|
const index = {};
|
|
107
|
-
const moduleRuntimeEnvironment = {
|
|
107
|
+
const moduleRuntimeEnvironment = {...runtimeEnvironment, bundle: false};
|
|
108
108
|
async function getUri(specifier) {
|
|
109
109
|
const moduleId = (0, import_identity.explodeSpecifier)(specifier);
|
|
110
110
|
if (!moduleId.version) {
|
|
111
111
|
throw new Error("Module specifier must include a version: " + specifier);
|
|
112
112
|
}
|
|
113
|
-
index[specifier] = await moduleRegistry.resolveModuleUri({
|
|
113
|
+
index[specifier] = await moduleRegistry.resolveModuleUri({...moduleId, version: moduleId.version}, moduleRuntimeEnvironment, runtimeParams);
|
|
114
114
|
}
|
|
115
115
|
const promises = [];
|
|
116
116
|
for (const specifier of specifiers) {
|
package/build/cjs/metrics.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
3
|
var __export = (target, all) => {
|
|
4
|
-
__markAsModule(target);
|
|
5
4
|
for (var name in all)
|
|
6
|
-
__defProp(target, name, {
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
// packages/@lwrjs/shared-utils/src/metrics.ts
|
|
9
|
+
__markAsModule(exports);
|
|
10
10
|
__export(exports, {
|
|
11
11
|
ON_APP_INIT: () => ON_APP_INIT,
|
|
12
12
|
ON_APP_LOAD: () => ON_APP_LOAD
|
package/build/cjs/object.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
3
|
var __export = (target, all) => {
|
|
4
|
-
__markAsModule(target);
|
|
5
4
|
for (var name in all)
|
|
6
|
-
__defProp(target, name, {
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
// packages/@lwrjs/shared-utils/src/object.ts
|
|
9
|
+
__markAsModule(exports);
|
|
10
10
|
__export(exports, {
|
|
11
11
|
debounce: () => debounce,
|
|
12
12
|
deepFreeze: () => deepFreeze
|
package/build/cjs/serialize.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
3
|
var __export = (target, all) => {
|
|
4
|
-
__markAsModule(target);
|
|
5
4
|
for (var name in all)
|
|
6
|
-
__defProp(target, name, {
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
// packages/@lwrjs/shared-utils/src/serialize.ts
|
|
9
|
+
__markAsModule(exports);
|
|
10
10
|
__export(exports, {
|
|
11
11
|
replaceStringFromLocation: () => replaceStringFromLocation,
|
|
12
12
|
serializeModuleToJson: () => serializeModuleToJson
|
|
@@ -14,7 +14,7 @@ __export(exports, {
|
|
|
14
14
|
async function createJsonModule(moduleId, moduleRegistry, runtimeEnvironment, runtimeParams) {
|
|
15
15
|
const {
|
|
16
16
|
ownHash,
|
|
17
|
-
moduleEntry: {
|
|
17
|
+
moduleEntry: {version}
|
|
18
18
|
} = await moduleRegistry.getModule(moduleId, runtimeParams);
|
|
19
19
|
return {
|
|
20
20
|
specifier: moduleId.specifier,
|
|
@@ -30,10 +30,10 @@ async function serializeModuleToJson(code = "", {
|
|
|
30
30
|
version,
|
|
31
31
|
ownHash,
|
|
32
32
|
runtimeEnvironment,
|
|
33
|
-
linkedConfig: {
|
|
34
|
-
moduleRecord: {
|
|
33
|
+
linkedConfig: {minified},
|
|
34
|
+
moduleRecord: {imports = []}
|
|
35
35
|
}, moduleRegistry, runtimeParams) {
|
|
36
|
-
const {
|
|
36
|
+
const {format} = runtimeEnvironment;
|
|
37
37
|
const dependencies = imports.map((dep) => createJsonModule(dep, moduleRegistry, runtimeEnvironment, runtimeParams));
|
|
38
38
|
return {
|
|
39
39
|
specifier,
|
|
@@ -45,6 +45,6 @@ async function serializeModuleToJson(code = "", {
|
|
|
45
45
|
code
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function replaceStringFromLocation(src, {
|
|
48
|
+
function replaceStringFromLocation(src, {startOffset, endOffset}, replaceValue) {
|
|
49
49
|
return src.substr(0, startOffset) + replaceValue + src.substr(endOffset, src.length);
|
|
50
50
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// packages/@lwrjs/shared-utils/src/tasks.ts
|
|
9
|
+
__markAsModule(exports);
|
|
10
|
+
__export(exports, {
|
|
11
|
+
InflightTasks: () => InflightTasks,
|
|
12
|
+
TaskPool: () => TaskPool
|
|
13
|
+
});
|
|
14
|
+
var Task = class {
|
|
15
|
+
constructor(taskFunction, caller, resolve, reject) {
|
|
16
|
+
this.taskFunction = taskFunction;
|
|
17
|
+
this.caller = caller;
|
|
18
|
+
this.resolve = resolve;
|
|
19
|
+
this.reject = reject;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var TaskPool = class {
|
|
23
|
+
constructor(size) {
|
|
24
|
+
this.queue = [];
|
|
25
|
+
this.running = 0;
|
|
26
|
+
this.size = size || 15;
|
|
27
|
+
}
|
|
28
|
+
async execute(taskFunction, caller) {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const task = new Task(taskFunction, caller || this, resolve, reject);
|
|
31
|
+
if (this.running >= this.size) {
|
|
32
|
+
this.queue.push(task);
|
|
33
|
+
} else {
|
|
34
|
+
this.start(task);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async start(task) {
|
|
39
|
+
this.running++;
|
|
40
|
+
try {
|
|
41
|
+
const ret = await task.taskFunction.bind(task.caller)();
|
|
42
|
+
task.resolve(ret);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
task.reject(err);
|
|
45
|
+
} finally {
|
|
46
|
+
this.running--;
|
|
47
|
+
this.runNext();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
runNext() {
|
|
51
|
+
const next = this.queue.shift();
|
|
52
|
+
if (next) {
|
|
53
|
+
this.start(next);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var InflightTasks = class {
|
|
58
|
+
constructor() {
|
|
59
|
+
this.tasks = new Map();
|
|
60
|
+
}
|
|
61
|
+
execute(id, taskCtor, caller) {
|
|
62
|
+
if (this.tasks.has(id)) {
|
|
63
|
+
return this.tasks.get(id);
|
|
64
|
+
} else {
|
|
65
|
+
const job = taskCtor.bind(caller || this)().finally(() => {
|
|
66
|
+
this.tasks.delete(id);
|
|
67
|
+
});
|
|
68
|
+
this.tasks.set(id, job);
|
|
69
|
+
return job;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
package/build/cjs/typescript.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/typescript.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
transpileTs: () => transpileTs
|
|
28
28
|
});
|
|
@@ -41,7 +41,7 @@ var ESBUILD_EXTENSION_PLUGIN = function(absFilePath, format) {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "replace-extension-plugin",
|
|
43
43
|
setup(build) {
|
|
44
|
-
build.onResolve({
|
|
44
|
+
build.onResolve({filter: /.*/}, ({path, importer, resolveDir}) => {
|
|
45
45
|
if (path !== absFilePath) {
|
|
46
46
|
if (path.startsWith(".")) {
|
|
47
47
|
const importeeExt = (0, import_path.extname)(path);
|
|
@@ -50,7 +50,7 @@ var ESBUILD_EXTENSION_PLUGIN = function(absFilePath, format) {
|
|
|
50
50
|
if (!import_fs.default.existsSync(absPath) && ext === ".js") {
|
|
51
51
|
absPath = absPath.replace(".js", ".ts");
|
|
52
52
|
}
|
|
53
|
-
return {
|
|
53
|
+
return {path: absPath};
|
|
54
54
|
} else {
|
|
55
55
|
return {
|
|
56
56
|
external: true
|
|
@@ -61,7 +61,7 @@ var ESBUILD_EXTENSION_PLUGIN = function(absFilePath, format) {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
-
async function transpileTs(tsAbsPath, {
|
|
64
|
+
async function transpileTs(tsAbsPath, {rootDir, cacheDir}) {
|
|
65
65
|
const format = isCommonJs ? "cjs" : "esm";
|
|
66
66
|
const ext = format === "esm" ? ".mjs" : ".cjs";
|
|
67
67
|
const pathRelativeToRoot = tsAbsPath.replace(new RegExp(`^${rootDir}`), "");
|
package/build/cjs/urls.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
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
|
-
__markAsModule(target);
|
|
10
9
|
for (var name in all)
|
|
11
|
-
__defProp(target, name, {
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
11
|
};
|
|
13
|
-
var
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
14
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
14
|
for (let key of __getOwnPropNames(module2))
|
|
16
15
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, {
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
18
17
|
}
|
|
19
18
|
return target;
|
|
20
19
|
};
|
|
21
20
|
var __toModule = (module2) => {
|
|
22
|
-
return
|
|
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);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// packages/@lwrjs/shared-utils/src/urls.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
extractRequestParams: () => extractRequestParams,
|
|
28
28
|
getClientBootstrapConfigurationRoutes: () => getClientBootstrapConfigurationRoutes,
|
|
@@ -38,8 +38,8 @@ function getClientBootstrapConfigurationUri(routeInfo, runtimeEnvironment, runti
|
|
|
38
38
|
return `${configUrlPrefix}/${encodeUrl}${CONFIG_SUFFIX}`;
|
|
39
39
|
}
|
|
40
40
|
function getClientBootstrapConfigurationUriPrefix(routeInfo, runtimeEnvironment, runtimeParams) {
|
|
41
|
-
const {
|
|
42
|
-
const {
|
|
41
|
+
const {apiVersion, format} = runtimeEnvironment;
|
|
42
|
+
const {id} = routeInfo;
|
|
43
43
|
const locale = runtimeParams?.locale;
|
|
44
44
|
const environment = runtimeParams?.environment;
|
|
45
45
|
if (locale && environment) {
|
package/build/es/identity.d.ts
CHANGED
|
@@ -33,6 +33,12 @@ export declare function normalizeVersionToUri(version: string): string;
|
|
|
33
33
|
* @example '1_0_0' => '1.0.0'
|
|
34
34
|
*/
|
|
35
35
|
export declare function normalizeVersionFromUri(version: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Create the last token for a module URL. Readable specifier for a URI
|
|
38
|
+
*
|
|
39
|
+
* examples/app/scoped/css?scoped=true => examples_app_scoped_css_scoped=true
|
|
40
|
+
*/
|
|
41
|
+
export declare function prettyModuleUriSuffix(specifier: string): string;
|
|
36
42
|
/**
|
|
37
43
|
* Create a partial Module Identifier from a specifier
|
|
38
44
|
* The Module Identifier is partial because the specifier may not contain a version
|
|
@@ -148,7 +154,7 @@ export declare function getModuleUriPrefix({ apiVersion, bundle, format, compat
|
|
|
148
154
|
* @param param0 - URI props from the Runtime Environment
|
|
149
155
|
* @param param1 - URI props from the Runtime Params
|
|
150
156
|
*/
|
|
151
|
-
export declare function getMappingUriPrefix({ apiVersion,
|
|
157
|
+
export declare function getMappingUriPrefix({ apiVersion, format, compat }: RuntimeEnvironment, { locale }?: RuntimeParams): string;
|
|
152
158
|
export { getCacheKeyFromJson };
|
|
153
159
|
export declare function isExternalUrl(url: string): boolean;
|
|
154
160
|
export declare function isBundleDefinition(definition: ModuleDefinition | BundleDefinition): definition is BundleDefinition;
|
package/build/es/identity.js
CHANGED
|
@@ -37,6 +37,15 @@ export function normalizeVersionToUri(version) {
|
|
|
37
37
|
export function normalizeVersionFromUri(version) {
|
|
38
38
|
return version.replace(/_/g, '.');
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Create the last token for a module URL. Readable specifier for a URI
|
|
42
|
+
*
|
|
43
|
+
* examples/app/scoped/css?scoped=true => examples_app_scoped_css_scoped=true
|
|
44
|
+
*/
|
|
45
|
+
export function prettyModuleUriSuffix(specifier) {
|
|
46
|
+
// eslint-disable-next-line no-useless-escape
|
|
47
|
+
return `${specifier.replace(/[\/\.\?\#]/g, '_')}`;
|
|
48
|
+
}
|
|
40
49
|
export function explodeSpecifier(rawSpecifier) {
|
|
41
50
|
const decodedSpecifier = decodeURIComponent(rawSpecifier);
|
|
42
51
|
// Split up the version and bare specifier
|
|
@@ -246,7 +255,7 @@ export function getModuleUriPrefix({ apiVersion, bundle, format, compat }, { loc
|
|
|
246
255
|
* @param param0 - URI props from the Runtime Environment
|
|
247
256
|
* @param param1 - URI props from the Runtime Params
|
|
248
257
|
*/
|
|
249
|
-
export function getMappingUriPrefix({ apiVersion,
|
|
258
|
+
export function getMappingUriPrefix({ apiVersion, format, compat }, { locale } = {}) {
|
|
250
259
|
const localePart = locale ? `/${LOCALE_SIGIL}/${locale}` : '';
|
|
251
260
|
return `/${apiVersion}/mapping/${format}/${compat}${localePart}/mp/`;
|
|
252
261
|
}
|
package/build/es/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './interchangeable-modules.js';
|
|
|
5
5
|
export * from './link.js';
|
|
6
6
|
export * from './object.js';
|
|
7
7
|
export * from './serialize.js';
|
|
8
|
+
export * from './tasks.js';
|
|
8
9
|
export * from './typescript.js';
|
|
9
10
|
export * from './import-metadata.js';
|
|
10
11
|
export * from './graph.js';
|
package/build/es/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './interchangeable-modules.js';
|
|
|
5
5
|
export * from './link.js';
|
|
6
6
|
export * from './object.js';
|
|
7
7
|
export * from './serialize.js';
|
|
8
|
+
export * from './tasks.js';
|
|
8
9
|
export * from './typescript.js';
|
|
9
10
|
export * from './import-metadata.js';
|
|
10
11
|
export * from './graph.js';
|
package/build/es/mappings.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractModuleId, FlattenedModuleGraphs, ImportMetadata, ModuleBundler, ModuleRegistry, RuntimeEnvironment, RuntimeParams } from '@lwrjs/types';
|
|
2
2
|
/**
|
|
3
|
-
* Get the Import Metadata for the LWR Mapping Api (https://rfcs.lwc.dev/rfcs/
|
|
3
|
+
* Get the Import Metadata for the LWR Mapping Api (https://rfcs.lwc.dev/rfcs/lwr/0000-mapping-api)
|
|
4
4
|
*/
|
|
5
5
|
export declare function getImportMetadataMappings(moduleIds: AbstractModuleId[], runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams, moduleRegistry: ModuleRegistry, moduleBundler: ModuleBundler): Promise<ImportMetadata>;
|
|
6
6
|
/**
|
|
@@ -13,7 +13,7 @@ export declare function getImportMetadataMappings(moduleIds: AbstractModuleId[],
|
|
|
13
13
|
*
|
|
14
14
|
* @param moduleGraph FlattenedModuleGraphs created by the graph shared util
|
|
15
15
|
* @param existingImportMetadata Optional existing ImportMetadata. If provided the results will be a merge the two sets of URI mappings.
|
|
16
|
-
* @returns Returns ImportMetadata from a module graph in the format here -> https://rfcs.lwc.dev/rfcs/
|
|
16
|
+
* @returns Returns ImportMetadata from a module graph in the format here -> https://rfcs.lwc.dev/rfcs/lwr/0000-mapping-api#uri-mapping-resource-specification
|
|
17
17
|
*/
|
|
18
18
|
export declare function toImportMetadata(moduleGraph: FlattenedModuleGraphs, existingImportMetadata: ImportMetadata | undefined, moduleRegistry: ModuleRegistry, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams): Promise<ImportMetadata>;
|
|
19
19
|
//# sourceMappingURL=mappings.d.ts.map
|
package/build/es/mappings.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getModuleGraphs, GraphDepth } from './graph.js';
|
|
2
2
|
import { explodeSpecifier, getSpecifier, isBundleDefinition } from './identity.js';
|
|
3
3
|
/**
|
|
4
|
-
* Get the Import Metadata for the LWR Mapping Api (https://rfcs.lwc.dev/rfcs/
|
|
4
|
+
* Get the Import Metadata for the LWR Mapping Api (https://rfcs.lwc.dev/rfcs/lwr/0000-mapping-api)
|
|
5
5
|
*/
|
|
6
6
|
export async function getImportMetadataMappings(moduleIds, runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler) {
|
|
7
7
|
const visitedCache = new Map();
|
|
@@ -10,13 +10,13 @@ export async function getImportMetadataMappings(moduleIds, runtimeEnvironment, r
|
|
|
10
10
|
index: {},
|
|
11
11
|
};
|
|
12
12
|
for (const moduleId of moduleIds) {
|
|
13
|
-
const specifier = moduleId
|
|
13
|
+
const specifier = getSpecifier(moduleId);
|
|
14
14
|
// Check if we have already visited
|
|
15
15
|
if (!visitedCache.has(specifier)) {
|
|
16
16
|
// Traversal of the Module Graph is done to get all the URLS for discoverable static dependencies.
|
|
17
17
|
const depth = { static: GraphDepth.ALL, dynamic: 0 };
|
|
18
18
|
// eslint-disable-next-line no-await-in-loop
|
|
19
|
-
const moduleGraph = await getModuleGraphs(
|
|
19
|
+
const moduleGraph = await getModuleGraphs(specifier,
|
|
20
20
|
// include uris and linked definitions
|
|
21
21
|
{ includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, runtimeEnvironment.bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams, visitedCache);
|
|
22
22
|
// Root module
|
|
@@ -36,7 +36,7 @@ export async function getImportMetadataMappings(moduleIds, runtimeEnvironment, r
|
|
|
36
36
|
*
|
|
37
37
|
* @param moduleGraph FlattenedModuleGraphs created by the graph shared util
|
|
38
38
|
* @param existingImportMetadata Optional existing ImportMetadata. If provided the results will be a merge the two sets of URI mappings.
|
|
39
|
-
* @returns Returns ImportMetadata from a module graph in the format here -> https://rfcs.lwc.dev/rfcs/
|
|
39
|
+
* @returns Returns ImportMetadata from a module graph in the format here -> https://rfcs.lwc.dev/rfcs/lwr/0000-mapping-api#uri-mapping-resource-specification
|
|
40
40
|
*/
|
|
41
41
|
export async function toImportMetadata(moduleGraph, existingImportMetadata = { imports: {}, index: {} }, moduleRegistry, runtimeEnvironment, runtimeParams = {}) {
|
|
42
42
|
// root module specifier
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pool is created of a given size
|
|
3
|
+
* If more tasks than that are asked to execute they are put in a queue until there is space in the pool
|
|
4
|
+
*/
|
|
5
|
+
export declare class TaskPool {
|
|
6
|
+
private size;
|
|
7
|
+
private queue;
|
|
8
|
+
private running;
|
|
9
|
+
constructor(size?: number);
|
|
10
|
+
/**
|
|
11
|
+
* Add a function that takes no arguments
|
|
12
|
+
* It will run as soon as there is room in the pool
|
|
13
|
+
*
|
|
14
|
+
* @param taskFunction - Function to run when there is space in the pool
|
|
15
|
+
* @param caller - The closer to use when calling the constructor
|
|
16
|
+
**/
|
|
17
|
+
execute(taskFunction: Function, caller?: any): Promise<any>;
|
|
18
|
+
private start;
|
|
19
|
+
private runNext;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Contains a map of tasks that are in progress
|
|
23
|
+
* Calls to execute with the id of a task in progress returns the running tasks
|
|
24
|
+
* If no task of that id is running a new task is created
|
|
25
|
+
*/
|
|
26
|
+
export declare class InflightTasks<Type> {
|
|
27
|
+
private tasks;
|
|
28
|
+
/**
|
|
29
|
+
* Return a promise per id. If one is already in flight return the promise.
|
|
30
|
+
* If not use the constructor to create a new
|
|
31
|
+
*
|
|
32
|
+
* @param id - Unique id for promise in question
|
|
33
|
+
* @param taskCtor - Function that create a promise for the id if needed
|
|
34
|
+
* @param caller - The closer to use when calling the constructor
|
|
35
|
+
*/
|
|
36
|
+
execute(id: string, taskCtor: Function, caller?: any): Promise<Type>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
class Task {
|
|
2
|
+
constructor(taskFunction, caller, resolve, reject) {
|
|
3
|
+
this.taskFunction = taskFunction;
|
|
4
|
+
this.caller = caller;
|
|
5
|
+
this.resolve = resolve;
|
|
6
|
+
this.reject = reject;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A pool is created of a given size
|
|
11
|
+
* If more tasks than that are asked to execute they are put in a queue until there is space in the pool
|
|
12
|
+
*/
|
|
13
|
+
export class TaskPool {
|
|
14
|
+
constructor(size) {
|
|
15
|
+
this.queue = [];
|
|
16
|
+
this.running = 0;
|
|
17
|
+
this.size = size || 15;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Add a function that takes no arguments
|
|
21
|
+
* It will run as soon as there is room in the pool
|
|
22
|
+
*
|
|
23
|
+
* @param taskFunction - Function to run when there is space in the pool
|
|
24
|
+
* @param caller - The closer to use when calling the constructor
|
|
25
|
+
**/
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
27
|
+
async execute(taskFunction, caller) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const task = new Task(taskFunction, caller || this, resolve, reject);
|
|
30
|
+
if (this.running >= this.size) {
|
|
31
|
+
this.queue.push(task);
|
|
32
|
+
// TODO add to profiling
|
|
33
|
+
// console.log('[DEBUG] TaskPool Queue Size: ' + this.queue.length);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.start(task);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async start(task) {
|
|
41
|
+
// Add run next
|
|
42
|
+
this.running++;
|
|
43
|
+
try {
|
|
44
|
+
const ret = await task.taskFunction.bind(task.caller)();
|
|
45
|
+
task.resolve(ret);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
task.reject(err);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
this.running--;
|
|
52
|
+
this.runNext();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
runNext() {
|
|
56
|
+
const next = this.queue.shift();
|
|
57
|
+
if (next) {
|
|
58
|
+
// TODO add to profiling
|
|
59
|
+
// console.log('[DEBUG] TaskPool Queue Size: ' + this.queue.length);
|
|
60
|
+
this.start(next);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Contains a map of tasks that are in progress
|
|
66
|
+
* Calls to execute with the id of a task in progress returns the running tasks
|
|
67
|
+
* If no task of that id is running a new task is created
|
|
68
|
+
*/
|
|
69
|
+
export class InflightTasks {
|
|
70
|
+
constructor() {
|
|
71
|
+
this.tasks = new Map();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Return a promise per id. If one is already in flight return the promise.
|
|
75
|
+
* If not use the constructor to create a new
|
|
76
|
+
*
|
|
77
|
+
* @param id - Unique id for promise in question
|
|
78
|
+
* @param taskCtor - Function that create a promise for the id if needed
|
|
79
|
+
* @param caller - The closer to use when calling the constructor
|
|
80
|
+
*/
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
82
|
+
execute(id, taskCtor, caller) {
|
|
83
|
+
if (this.tasks.has(id)) {
|
|
84
|
+
return this.tasks.get(id);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const job = taskCtor
|
|
88
|
+
.bind(caller || this)()
|
|
89
|
+
.finally(() => {
|
|
90
|
+
// Once fulfilled remove form active jobs
|
|
91
|
+
this.tasks.delete(id);
|
|
92
|
+
});
|
|
93
|
+
this.tasks.set(id, job);
|
|
94
|
+
return job;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=tasks.js.map
|
package/build/es/urls.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RuntimeEnvironment, RuntimeParams } from '@lwrjs/types';
|
|
2
2
|
export declare function getClientBootstrapConfigurationUri(routeInfo: {
|
|
3
3
|
id: string;
|
|
4
4
|
url: string;
|
|
5
|
-
}, runtimeEnvironment:
|
|
6
|
-
apiVersion: string;
|
|
7
|
-
format: ModuleFormat;
|
|
8
|
-
}, runtimeParams?: RuntimeParams): string;
|
|
5
|
+
}, runtimeEnvironment: Required<Pick<RuntimeEnvironment, 'apiVersion' | 'format'>>, runtimeParams?: RuntimeParams): string;
|
|
9
6
|
export declare function getClientBootstrapConfigurationUriPrefix(routeInfo: {
|
|
10
7
|
id: string;
|
|
11
|
-
}, runtimeEnvironment:
|
|
12
|
-
apiVersion: string;
|
|
13
|
-
format: ModuleFormat;
|
|
14
|
-
}, runtimeParams?: RuntimeParams): string;
|
|
8
|
+
}, runtimeEnvironment: Required<Pick<RuntimeEnvironment, 'apiVersion' | 'format'>>, runtimeParams?: RuntimeParams): string;
|
|
15
9
|
/**
|
|
16
10
|
* Remove the suffix from config
|
|
17
11
|
*/
|
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.6.0-alpha.
|
|
8
|
-
"homepage": "https://
|
|
7
|
+
"version": "0.6.0-alpha.6",
|
|
8
|
+
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/salesforce/lwr.git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"chokidar": "^3.4.0",
|
|
37
37
|
"es-module-lexer": "^0.3.18",
|
|
38
|
-
"esbuild": "^0.
|
|
38
|
+
"esbuild": "^0.9.7",
|
|
39
39
|
"fast-json-stable-stringify": "^2.1.0",
|
|
40
40
|
"magic-string": "^0.25.7",
|
|
41
41
|
"mime-types": "^2.1.33",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"slugify": "^1.4.5"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@lwrjs/diagnostics": "0.6.0-alpha.
|
|
47
|
-
"@lwrjs/types": "0.6.0-alpha.
|
|
46
|
+
"@lwrjs/diagnostics": "0.6.0-alpha.6",
|
|
47
|
+
"@lwrjs/types": "0.6.0-alpha.6",
|
|
48
48
|
"@types/mime-types": "2.1.1",
|
|
49
49
|
"@types/path-to-regexp": "^1.7.0"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=14.15.4 <17"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "5d624e196dd46787399e6a269479508abe236081"
|
|
55
55
|
}
|