@lwrjs/everywhere 0.10.0-alpha.4 → 0.10.0-alpha.7
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/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/7b0c61d0b2d8909f14cb1696902a019c/config.js +10 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/{0_10_0-alpha_4 → 0_10_0-alpha_7}/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +5 -5
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa/lwc.js +2 -2
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_10_0-alpha_4 → 0_10_0-alpha_7}/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js +4 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_10_0-alpha_4/s/40ee427a297bdafb395afc6780a220ca → 0_10_0-alpha_7/s/d26177a61a766e129dee91ebcadb74d7}/lwr_init.js +36 -7
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_10_0-alpha_4/s/e2d690cbeb4c1efcceba285be35492db → 0_10_0-alpha_7/s/554e119a3f34b1362ff4ceb3a97b0d25}/lwr_loader.js +74 -11
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_10_0-alpha_4 → 0_10_0-alpha_7}/s/3426e42c3e22ce07ab2adc62c4c523a0/lwr_metrics.js +2 -2
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_10_0-alpha_4/s/e25f3b0b8b5c096acebf847d0a83ea62 → 0_10_0-alpha_7/s/4e65d4b97b3cc3d2f06a4cc284f3dd68}/lwr_profiler.js +5 -5
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_10_0-alpha_4 → 0_10_0-alpha_7}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +2 -2
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_10_0-alpha_4 → 0_10_0-alpha_7}/lwr-error-shim.js +2 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_10_0-alpha_4 → 0_10_0-alpha_7}/lwr-loader-shim.bundle.js +510 -246
- package/build/assets/amd/lwr-everywhere-debug.js +506 -276
- package/build/assets/amd/lwr-everywhere-min.js +1 -1
- package/build/assets/amd/lwr-everywhere.js +506 -276
- package/build/assets/core/lwr-everywhere-debug.js +504 -274
- package/build/assets/core/lwr-everywhere-min.js +1 -1
- package/build/assets/core/lwr-everywhere.js +504 -274
- package/build/assets/esm/lwr-everywhere-debug.js +10 -3
- package/build/assets/esm/lwr-everywhere-min.js +1 -1
- package/build/assets/esm/lwr-everywhere.js +10 -3
- package/build/generate.js +4 -9
- package/build/modules/@salesforce/lds-default-luvio/lds-default-luvio.d.ts +3 -3
- package/build/modules/lwr/host/host.js +1 -1
- package/build/modules/lwr/vault/vault.d.ts +1 -1
- package/build/utils.d.ts +1 -1
- package/package.json +8 -8
- package/src/generate.ts +6 -10
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/a5fe072e90fba19b6824bf2df53a28b6/config.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* This script is generated */
|
|
2
|
+
/* Client Bootstrap configuration */
|
|
3
|
+
globalThis.LWR = globalThis.LWR || {};
|
|
4
|
+
Object.assign(globalThis.LWR, {"appId":"amd-bootstrap","bootstrapModule":"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_7","autoBoot":true,"imports":{"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_10_0-alpha_7/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_10_0-alpha_7/s/d26177a61a766e129dee91ebcadb74d7/lwr_init.js":["lwr/init/v/0_10_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_10_0-alpha_7/s/3426e42c3e22ce07ab2adc62c4c523a0/lwr_metrics.js":["lwr/metrics/v/0_10_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_10_0-alpha_7/s/4e65d4b97b3cc3d2f06a4cc284f3dd68/lwr_profiler.js":["lwr/profiler/v/0_10_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa/lwc.js":["lwc/v/2_38_1"],"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_10_0-alpha_7/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js":["lwr/everywhereAmd/v/0_10_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_10_0-alpha_7/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js":["lwr/vault/v/0_10_0-alpha_7"]},"index":{"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_7":"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_10_0-alpha_7/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js","lwr/init/v/0_10_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_10_0-alpha_7/s/d26177a61a766e129dee91ebcadb74d7/lwr_init.js","lwr/metrics/v/0_10_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_10_0-alpha_7/s/3426e42c3e22ce07ab2adc62c4c523a0/lwr_metrics.js","lwr/profiler/v/0_10_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_10_0-alpha_7/s/4e65d4b97b3cc3d2f06a4cc284f3dd68/lwr_profiler.js","lwc/v/2_38_1":"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa/lwc.js","lwr/everywhereAmd/v/0_10_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_10_0-alpha_7/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js","lwr/vault/v/0_10_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_10_0-alpha_7/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js"},"rootComponents":["lwr/everywhereAmd/v/0_10_0-alpha_7"],"requiredModules":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_7"],"preloadModules":["lwr/init/v/0_10_0-alpha_7","lwr/metrics/v/0_10_0-alpha_7","lwc/v/2_38_1","lwr/everywhereAmd/v/0_10_0-alpha_7"],"endpoints":{"uris":{"mapping":"/1/mapping/amd/1/l/en-US/mp/"}}});
|
|
5
|
+
globalThis.process = { env: { NODE_ENV: "compat" } };
|
|
6
|
+
// Appended by Static Site Generator
|
|
7
|
+
if (!globalThis.LWR.imports) { globalThis.LWR.imports = {}; }
|
|
8
|
+
Object.assign(globalThis.LWR.imports, {"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_10_0-alpha_7/s/554e119a3f34b1362ff4ceb3a97b0d25/lwr_loader.js":["lwr/loader/v/0_10_0-alpha_7"]})
|
|
9
|
+
if (!globalThis.LWR.index) { globalThis.LWR.index = {}; }
|
|
10
|
+
Object.assign(globalThis.LWR.index, {"lwr/loader/v/0_10_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_10_0-alpha_7/s/554e119a3f34b1362ff4ceb3a97b0d25/lwr_loader.js"})
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-
|
|
1
|
+
LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_7', ['lwr/loader/v/0_10_0-alpha_7', 'lwr/init/v/0_10_0-alpha_7'], (function (_0_10_0Alpha_7$1, _0_10_0Alpha_7) { 'use strict';
|
|
2
2
|
|
|
3
3
|
const clientBootstrapConfig = globalThis.LWR;
|
|
4
4
|
|
|
5
5
|
// initialize additional non-configured root components
|
|
6
6
|
const { rootComponents, ssrProps } = clientBootstrapConfig;
|
|
7
7
|
Promise.all(rootComponents.map(async (rootSpecifier) => {
|
|
8
|
-
const element =
|
|
9
|
-
return
|
|
10
|
-
|
|
8
|
+
const element = _0_10_0Alpha_7.toKebabCase(rootSpecifier);
|
|
9
|
+
return _0_10_0Alpha_7$1.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_7').then(({default: Ctor}) => {
|
|
10
|
+
_0_10_0Alpha_7.init([[element, Ctor]], ssrProps);
|
|
11
11
|
});
|
|
12
12
|
}));
|
|
13
13
|
|
|
@@ -15,4 +15,4 @@ LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_4', ['lwr
|
|
|
15
15
|
define: globalThis.LWR.define,
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
});
|
|
18
|
+
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
1
|
+
LWR.define('lwc/v/2_38_1', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/* proxy-compat-disable */
|
|
4
4
|
/**
|
|
@@ -8931,4 +8931,4 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8931
8931
|
|
|
8932
8932
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8933
8933
|
|
|
8934
|
-
});
|
|
8934
|
+
}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
LWR.define('lwr/everywhereAmd/v/0_10_0-
|
|
1
|
+
LWR.define('lwr/everywhereAmd/v/0_10_0-alpha_7', ['exports', 'lwr/vault/v/0_10_0-alpha_7'], (function (exports, _0_10_0Alpha_7) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
|
|
4
4
|
|
|
5
5
|
// Do an OAuthed fetch
|
|
6
6
|
async function authFetch(url, accept = 'javascript') {
|
|
7
|
-
const authInfo =
|
|
7
|
+
const authInfo = _0_10_0Alpha_7.getAuthInfo();
|
|
8
8
|
if (authInfo) {
|
|
9
9
|
return fetch(url, {
|
|
10
10
|
headers: {
|
|
@@ -54,7 +54,7 @@ LWR.define('lwr/everywhereAmd/v/0_10_0-alpha_4', ['exports', 'lwr/vault/v/0_10_0
|
|
|
54
54
|
function authenticate(authInfo) {
|
|
55
55
|
// Put OAuth info into the vault
|
|
56
56
|
if (authInfo) {
|
|
57
|
-
|
|
57
|
+
_0_10_0Alpha_7.setAuthInfo(authInfo);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -63,4 +63,4 @@ LWR.define('lwr/everywhereAmd/v/0_10_0-alpha_4', ['exports', 'lwr/vault/v/0_10_0
|
|
|
63
63
|
|
|
64
64
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
65
65
|
|
|
66
|
-
});
|
|
66
|
+
}));
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
LWR.define('lwr/init/v/0_10_0-
|
|
1
|
+
LWR.define('lwr/init/v/0_10_0-alpha_7', ['exports', 'lwr/metrics/v/0_10_0-alpha_7', 'lwr/profiler/v/0_10_0-alpha_7', 'lwc/v/2_38_1'], (function (exports, _0_10_0Alpha_7$1, _0_10_0Alpha_7, lwc) { 'use strict';
|
|
2
2
|
|
|
3
|
+
function _interopNamespace(e) {
|
|
4
|
+
if (e && e.__esModule) return e;
|
|
5
|
+
var n = Object.create(null);
|
|
6
|
+
if (e) {
|
|
7
|
+
Object.keys(e).forEach(function (k) {
|
|
8
|
+
if (k !== 'default') {
|
|
9
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return e[k]; }
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
n["default"] = e;
|
|
18
|
+
return Object.freeze(n);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var lwc__namespace = /*#__PURE__*/_interopNamespace(lwc);
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
24
|
function initializeWebComponent(elementName, Ctor) {
|
|
4
|
-
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
return lwc__namespace.createElement(elementName, {
|
|
5
28
|
is: Ctor
|
|
6
29
|
});
|
|
7
30
|
}
|
|
@@ -65,7 +88,9 @@ LWR.define('lwr/init/v/0_10_0-alpha_4', ['exports', 'lwr/metrics/v/0_10_0-alpha_
|
|
|
65
88
|
if (propsId) {
|
|
66
89
|
// Hydrate an SSRed component
|
|
67
90
|
const props = ssrProps[propsId] || {};
|
|
68
|
-
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
lwc__namespace.hydrateComponent(customElement, ctor, props);
|
|
69
94
|
} else {
|
|
70
95
|
// Create a CSRed component
|
|
71
96
|
const newElement = initializeWebComponent(elementName, ctor);
|
|
@@ -85,14 +110,18 @@ LWR.define('lwr/init/v/0_10_0-alpha_4', ['exports', 'lwr/metrics/v/0_10_0-alpha_
|
|
|
85
110
|
while (customElement.childNodes.length > 0) {
|
|
86
111
|
newElement.appendChild(customElement.childNodes[0]);
|
|
87
112
|
}
|
|
88
|
-
customElement.parentElement
|
|
113
|
+
if (customElement.parentElement) {
|
|
114
|
+
customElement.parentElement.replaceChild(newElement, customElement);
|
|
115
|
+
} else if (console) {
|
|
116
|
+
console.error(`[lwr/init] parentElement not set: %o`, customElement);
|
|
117
|
+
}
|
|
89
118
|
}
|
|
90
119
|
});
|
|
91
120
|
}
|
|
92
121
|
});
|
|
93
122
|
}
|
|
94
|
-
|
|
95
|
-
id:
|
|
123
|
+
_0_10_0Alpha_7.logOperationStart({
|
|
124
|
+
id: _0_10_0Alpha_7$1.BOOTSTRAP_END
|
|
96
125
|
});
|
|
97
126
|
}
|
|
98
127
|
|
|
@@ -102,4 +131,4 @@ LWR.define('lwr/init/v/0_10_0-alpha_4', ['exports', 'lwr/metrics/v/0_10_0-alpha_
|
|
|
102
131
|
|
|
103
132
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
104
133
|
|
|
105
|
-
});
|
|
134
|
+
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/loader/v/0_10_0-
|
|
1
|
+
LWR.define('lwr/loader/v/0_10_0-alpha_7', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) 2021, salesforce.com, inc.
|
|
@@ -6,7 +6,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
6
6
|
* SPDX-License-Identifier: MIT
|
|
7
7
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8
8
|
*/
|
|
9
|
-
/* LWR Module Loader v0.10.0-alpha.
|
|
9
|
+
/* LWR Module Loader v0.10.0-alpha.7 */
|
|
10
10
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
12
|
function templateString(template, args) {
|
|
@@ -122,6 +122,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
122
122
|
level: 0,
|
|
123
123
|
message: 'Invalid import metadata: {0} {1}'
|
|
124
124
|
});
|
|
125
|
+
|
|
125
126
|
/* importMap errors */
|
|
126
127
|
Object.freeze({
|
|
127
128
|
code: 3011,
|
|
@@ -153,6 +154,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
153
154
|
}
|
|
154
155
|
return baseUrl;
|
|
155
156
|
}
|
|
157
|
+
|
|
156
158
|
/**
|
|
157
159
|
* Check if a string is a URL based on Common Internet Scheme Syntax
|
|
158
160
|
* https://www.ietf.org/rfc/rfc1738.txt
|
|
@@ -179,6 +181,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
179
181
|
function isUrl(url) {
|
|
180
182
|
return url.indexOf('://') !== -1;
|
|
181
183
|
}
|
|
184
|
+
|
|
182
185
|
// Borrowed and adapted from https://github.com/systemjs/systemjs/blob/master/src/common.js
|
|
183
186
|
// Resolves the first path segment relative to the second/parent URL
|
|
184
187
|
// eg: resolveIfNotPlainOrUrl('../test', 'http://www.site.com/one/two') => 'http://www.site.com/test'
|
|
@@ -207,6 +210,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
207
210
|
pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/' ? 1 : 0));
|
|
208
211
|
}
|
|
209
212
|
if (relUrl[0] === '/') return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
|
|
213
|
+
|
|
210
214
|
// join together and split for removal of .. and . segments
|
|
211
215
|
// looping the string instead of anything fancy for perf reasons
|
|
212
216
|
// '../../../../../z' resolved to 'x/y' is just 'z'
|
|
@@ -221,6 +225,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
221
225
|
segmentIndex = -1;
|
|
222
226
|
}
|
|
223
227
|
}
|
|
228
|
+
|
|
224
229
|
// new segment - check if it is relative
|
|
225
230
|
else if (segmented[i] === '.') {
|
|
226
231
|
// ../ segment
|
|
@@ -304,11 +309,20 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
304
309
|
|
|
305
310
|
/* spec based import map resolver */
|
|
306
311
|
class ImportMetadataResolver {
|
|
307
|
-
|
|
308
|
-
|
|
312
|
+
// Default to empty mappings
|
|
313
|
+
__init() {
|
|
309
314
|
this.importURICache = new Map();
|
|
315
|
+
}
|
|
316
|
+
__init2() {
|
|
310
317
|
this.pendingURICache = new Map();
|
|
318
|
+
}
|
|
319
|
+
__init3() {
|
|
311
320
|
this.loadMappingHooks = [];
|
|
321
|
+
}
|
|
322
|
+
constructor(config, invalidationCallback) {
|
|
323
|
+
ImportMetadataResolver.prototype.__init.call(this);
|
|
324
|
+
ImportMetadataResolver.prototype.__init2.call(this);
|
|
325
|
+
ImportMetadataResolver.prototype.__init3.call(this);
|
|
312
326
|
this.config = config;
|
|
313
327
|
this.invalidationCallback = invalidationCallback;
|
|
314
328
|
}
|
|
@@ -369,6 +383,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
369
383
|
});
|
|
370
384
|
}
|
|
371
385
|
}
|
|
386
|
+
|
|
372
387
|
// Get URL from the local cache or return undefiend
|
|
373
388
|
getURI(specifier) {
|
|
374
389
|
return this.importURICache.has(specifier) ? resolveUrl(this.importURICache.get(specifier).uri, this.getBaseUrl()) : undefined;
|
|
@@ -382,6 +397,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
382
397
|
}
|
|
383
398
|
return undefined;
|
|
384
399
|
}
|
|
400
|
+
|
|
385
401
|
/**
|
|
386
402
|
* Resolves a the URI for a specified module. It will return the value in this order:
|
|
387
403
|
*
|
|
@@ -432,6 +448,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
432
448
|
hasMappingHooks() {
|
|
433
449
|
return this.loadMappingHooks.length > 0;
|
|
434
450
|
}
|
|
451
|
+
|
|
435
452
|
/**
|
|
436
453
|
* Evaluates mapping hooks. Returns first match. If all hooks return null call the mapping service.
|
|
437
454
|
* @param specifier Request module identifier
|
|
@@ -454,6 +471,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
454
471
|
}
|
|
455
472
|
}
|
|
456
473
|
}
|
|
474
|
+
|
|
457
475
|
// If we still do not have a match call the mapping service
|
|
458
476
|
return this.fetchNewMappings(specifier);
|
|
459
477
|
}
|
|
@@ -461,6 +479,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
461
479
|
if (typeof globalThis.fetch !== 'function') {
|
|
462
480
|
throw new LoaderError(UNRESOLVED, [specifier]);
|
|
463
481
|
}
|
|
482
|
+
|
|
464
483
|
// TODO For module invalidation with bundles it is recommended we have to send back all loaded root specified
|
|
465
484
|
// to ensure we detect all conflicts.
|
|
466
485
|
const uri = resolveUrl(this.buildMappingUrl(specifier), this.getBaseUrl());
|
|
@@ -525,6 +544,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
525
544
|
const MODULE_LOAD_TIMEOUT_TIMER = 300000;
|
|
526
545
|
|
|
527
546
|
/* global console,process */
|
|
547
|
+
|
|
528
548
|
let lastWindowError;
|
|
529
549
|
if (hasDocument) {
|
|
530
550
|
globalThis.addEventListener('error', evt => {
|
|
@@ -603,14 +623,12 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
603
623
|
}
|
|
604
624
|
|
|
605
625
|
/* global console,process */
|
|
626
|
+
|
|
606
627
|
class ModuleRegistry {
|
|
607
628
|
constructor(config) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
this.moduleRegistry = new Map();
|
|
612
|
-
// Aliases of modules in the registry
|
|
613
|
-
this.aliases = new Map();
|
|
629
|
+
ModuleRegistry.prototype.__init.call(this);
|
|
630
|
+
ModuleRegistry.prototype.__init2.call(this);
|
|
631
|
+
ModuleRegistry.prototype.__init3.call(this);
|
|
614
632
|
this.profiler = config.profiler;
|
|
615
633
|
this.resolver = new ImportMetadataResolver(config, this.importMetadataInvalidationCallback.bind(this));
|
|
616
634
|
}
|
|
@@ -628,6 +646,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
628
646
|
}
|
|
629
647
|
async resolve(id, importer) {
|
|
630
648
|
const parentUrl = this.resolver.getBaseUrl(); // only support baseUrl for now
|
|
649
|
+
|
|
631
650
|
let resolved;
|
|
632
651
|
let aliasedId = id;
|
|
633
652
|
const resolveHooks = this.resolveHook;
|
|
@@ -642,6 +661,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
642
661
|
// eslint-disable-next-line no-await-in-loop
|
|
643
662
|
result = isResponseAPromise(response) ? await response : response;
|
|
644
663
|
}
|
|
664
|
+
|
|
645
665
|
// if result is not null, attempt resolution
|
|
646
666
|
if (result !== null) {
|
|
647
667
|
if (typeof result === 'string') {
|
|
@@ -671,6 +691,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
671
691
|
}
|
|
672
692
|
if (!resolved) {
|
|
673
693
|
const resolvedOrPlain = resolveIfNotPlainOrUrl(id, parentUrl) || id;
|
|
694
|
+
|
|
674
695
|
// if module registry already has named module the resolved id is the plain id
|
|
675
696
|
if (this.moduleRegistry.has(resolvedOrPlain)) {
|
|
676
697
|
return resolvedOrPlain;
|
|
@@ -737,6 +758,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
737
758
|
this.namedDefineRegistry.set(name, moduleDef);
|
|
738
759
|
this.lastDefine = moduleDef;
|
|
739
760
|
}
|
|
761
|
+
|
|
740
762
|
/**
|
|
741
763
|
* Marks modules as "externally" loaded/provided, so that the loader does not attempt to fetch them.
|
|
742
764
|
*
|
|
@@ -749,6 +771,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
749
771
|
let timer;
|
|
750
772
|
const moduleDefPromise = new Promise((resolve, reject) => {
|
|
751
773
|
resolveExternal = resolve;
|
|
774
|
+
|
|
752
775
|
// watch the external for timeout
|
|
753
776
|
// eslint-disable-next-line lwr/no-unguarded-apis, no-undef
|
|
754
777
|
timer = setTimeout(() => {
|
|
@@ -773,9 +796,25 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
773
796
|
}
|
|
774
797
|
});
|
|
775
798
|
}
|
|
799
|
+
|
|
800
|
+
// A registry for named AMD defines containing the *metadata* of AMD module
|
|
801
|
+
__init() {
|
|
802
|
+
this.namedDefineRegistry = new Map();
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// The evaluated module registry where the module identifier (name or URL?) is the key
|
|
806
|
+
__init2() {
|
|
807
|
+
this.moduleRegistry = new Map();
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Aliases of modules in the registry
|
|
811
|
+
__init3() {
|
|
812
|
+
this.aliases = new Map();
|
|
813
|
+
}
|
|
776
814
|
getImportMetadataResolver() {
|
|
777
815
|
return this.resolver;
|
|
778
816
|
}
|
|
817
|
+
|
|
779
818
|
// Returns an existing module record by the resolvedId or aliased id
|
|
780
819
|
getExistingModuleRecord(resolvedId, aliasId) {
|
|
781
820
|
const moduleRecord = this.moduleRegistry.get(resolvedId);
|
|
@@ -783,6 +822,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
783
822
|
this.storeModuleAlias(aliasId, resolvedId);
|
|
784
823
|
return moduleRecord;
|
|
785
824
|
}
|
|
825
|
+
|
|
786
826
|
// Check if this is a known alias
|
|
787
827
|
if (resolvedId !== aliasId) {
|
|
788
828
|
const alias = this.aliases.get(aliasId);
|
|
@@ -802,6 +842,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
802
842
|
// return existing
|
|
803
843
|
return existingRecord;
|
|
804
844
|
}
|
|
845
|
+
|
|
805
846
|
// Create a new Module Record
|
|
806
847
|
const instantiation = this.getModuleDef(resolvedId, id);
|
|
807
848
|
const dependencyRecords = instantiation.then(moduleDef => {
|
|
@@ -846,11 +887,13 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
846
887
|
const resolvedDepId = await this.resolve(dependency);
|
|
847
888
|
return this.getModuleRecord(resolvedDepId, dependency);
|
|
848
889
|
}
|
|
890
|
+
|
|
849
891
|
// execute the "top-level code" (the code outside of functions) of a module
|
|
850
892
|
async topLevelEvaluation(moduleRecord) {
|
|
851
893
|
await this.instantiateAll(moduleRecord, {});
|
|
852
894
|
return this.evaluateModule(moduleRecord, {});
|
|
853
895
|
}
|
|
896
|
+
|
|
854
897
|
// Returns a promise when a module and all of it's dependencies have finished instantiation
|
|
855
898
|
async instantiateAll(moduleRecord, instantiatedMap) {
|
|
856
899
|
if (!instantiatedMap[moduleRecord.id]) {
|
|
@@ -888,6 +931,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
888
931
|
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
|
889
932
|
}
|
|
890
933
|
const module = moduleRecord.module;
|
|
934
|
+
|
|
891
935
|
/**
|
|
892
936
|
* Circular dependencies are handled properly when named exports are used,
|
|
893
937
|
* however, for default exports there is a bug: https://github.com/rollup/rollup/issues/3384
|
|
@@ -902,12 +946,15 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
902
946
|
}
|
|
903
947
|
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
|
904
948
|
}));
|
|
949
|
+
|
|
905
950
|
// W-10029836 - In the case where we could be instantiating multiple graphs at the same time lets make sure the module have not already been evaluated
|
|
906
951
|
if (moduleRecord.evaluated) {
|
|
907
952
|
return moduleRecord.module;
|
|
908
953
|
}
|
|
954
|
+
|
|
909
955
|
// evaluates the module function
|
|
910
956
|
let moduleDefault = exporter(...depsMapped);
|
|
957
|
+
|
|
911
958
|
// value is returned from exporter, then we are not using named exports
|
|
912
959
|
if (moduleDefault !== undefined) {
|
|
913
960
|
moduleDefault = {
|
|
@@ -930,6 +977,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
930
977
|
}
|
|
931
978
|
}
|
|
932
979
|
const moduleExports = moduleDefault || exports;
|
|
980
|
+
|
|
933
981
|
// update the module record
|
|
934
982
|
// copy over enumerable public methods to module
|
|
935
983
|
for (const key in moduleExports) {
|
|
@@ -943,6 +991,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
943
991
|
}
|
|
944
992
|
});
|
|
945
993
|
}
|
|
994
|
+
|
|
946
995
|
// copy non-enumerable to module
|
|
947
996
|
if (moduleExports.__useDefault) {
|
|
948
997
|
Object.defineProperty(moduleRecord.module, '__useDefault', {
|
|
@@ -963,10 +1012,12 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
963
1012
|
Object.freeze(moduleRecord.module);
|
|
964
1013
|
return moduleRecord.module;
|
|
965
1014
|
}
|
|
1015
|
+
|
|
966
1016
|
// Determines if named exports module has only default export
|
|
967
1017
|
isNamedExportDefaultOnly(exports) {
|
|
968
1018
|
return exports !== undefined && Object.getOwnPropertyNames(exports).length === 2 && Object.prototype.hasOwnProperty.call(exports, 'default') && Object.prototype.hasOwnProperty.call(exports, '__esModule');
|
|
969
1019
|
}
|
|
1020
|
+
|
|
970
1021
|
// Wrap the dependency in a function that can be called and detected by __circular__ property.
|
|
971
1022
|
// The LWC engine checks for __circular__ to detect circular dependencies.
|
|
972
1023
|
getCircularDependencyWrapper(module) {
|
|
@@ -989,6 +1040,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
989
1040
|
async getModuleDef(resolvedId, originalId) {
|
|
990
1041
|
// reset lastDefine
|
|
991
1042
|
this.lastDefine = undefined;
|
|
1043
|
+
|
|
992
1044
|
// the module name can be the resolved ID or the original ID if neither are URL's.
|
|
993
1045
|
const moduleName = !isUrl(resolvedId) ? resolvedId : originalId !== resolvedId ? originalId : undefined;
|
|
994
1046
|
let moduleDef = moduleName && this.namedDefineRegistry.get(moduleName);
|
|
@@ -1029,10 +1081,12 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1029
1081
|
}).then(() => {
|
|
1030
1082
|
// Attempt to retrieve the module definition by name first
|
|
1031
1083
|
moduleDef = moduleName && this.namedDefineRegistry.get(moduleName);
|
|
1084
|
+
|
|
1032
1085
|
// Fallback to the last loader.define call
|
|
1033
1086
|
if (!moduleDef) {
|
|
1034
1087
|
moduleDef = this.lastDefine;
|
|
1035
1088
|
}
|
|
1089
|
+
|
|
1036
1090
|
// This should not happen
|
|
1037
1091
|
if (!moduleDef) {
|
|
1038
1092
|
throw new LoaderError(FAIL_INSTANTIATE, [resolvedId]);
|
|
@@ -1116,6 +1170,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1116
1170
|
if (!mappingEndpoint) {
|
|
1117
1171
|
throw new LoaderError(NO_MAPPING_URL);
|
|
1118
1172
|
}
|
|
1173
|
+
|
|
1119
1174
|
// add a trailing slash, if it does not exist
|
|
1120
1175
|
config.endpoints.uris.mapping = mappingEndpoint.replace(/\/?$/, '/');
|
|
1121
1176
|
if (baseUrl) {
|
|
@@ -1144,6 +1199,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1144
1199
|
baseUrl,
|
|
1145
1200
|
profiler
|
|
1146
1201
|
}));
|
|
1202
|
+
|
|
1147
1203
|
// TODO: W-10539691 - temp workaround for LWR-Java -- remove once appId is implemented there
|
|
1148
1204
|
if (config.appMetadata && !config.appMetadata.appId) {
|
|
1149
1205
|
// Parse the appId from the bootstrapModule
|
|
@@ -1152,6 +1208,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1152
1208
|
const appId = match && match[1];
|
|
1153
1209
|
config.appMetadata.appId = appId;
|
|
1154
1210
|
}
|
|
1211
|
+
|
|
1155
1212
|
// TODO: https://github.com/salesforce-experience-platform-emu/lwr/issues/1087
|
|
1156
1213
|
this.services = Object.freeze({
|
|
1157
1214
|
addLoaderPlugin: this.registry.addLoaderPlugin.bind(this.registry),
|
|
@@ -1159,6 +1216,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1159
1216
|
appMetadata: config.appMetadata
|
|
1160
1217
|
});
|
|
1161
1218
|
}
|
|
1219
|
+
|
|
1162
1220
|
/**
|
|
1163
1221
|
* Defines/registers a single named AMD module definition.
|
|
1164
1222
|
*
|
|
@@ -1171,6 +1229,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1171
1229
|
invariant(typeof name === 'string', MISSING_NAME);
|
|
1172
1230
|
let ctor = execute;
|
|
1173
1231
|
let deps = dependencies;
|
|
1232
|
+
|
|
1174
1233
|
// Convert no dependencies form `define('name', function(){}, {});` to: `define('name', [], function(){}, {})`
|
|
1175
1234
|
if (typeof deps === 'function') {
|
|
1176
1235
|
ctor = dependencies;
|
|
@@ -1179,6 +1238,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1179
1238
|
invariant(Array.isArray(deps), INVALID_DEPS);
|
|
1180
1239
|
this.registry.define(name, deps, ctor);
|
|
1181
1240
|
}
|
|
1241
|
+
|
|
1182
1242
|
/**
|
|
1183
1243
|
* Retrieves/loads a module, returning it from the registry if it exists and fetching it if it doesn't.
|
|
1184
1244
|
*
|
|
@@ -1190,6 +1250,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1190
1250
|
async load(id, importer) {
|
|
1191
1251
|
return this.registry.load(id, importer);
|
|
1192
1252
|
}
|
|
1253
|
+
|
|
1193
1254
|
/**
|
|
1194
1255
|
* Checks if a Module exists in the registry. Note, returns false even if the ModuleDefinition exists but the Module has not been instantiated yet (executed).
|
|
1195
1256
|
*
|
|
@@ -1199,6 +1260,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1199
1260
|
has(id) {
|
|
1200
1261
|
return this.registry.has(id);
|
|
1201
1262
|
}
|
|
1263
|
+
|
|
1202
1264
|
/**
|
|
1203
1265
|
* Resolves the module identifier or URL. Returns the module identifier if the moduleDefinition exists, or the full resolved URL if a URL is given.
|
|
1204
1266
|
*
|
|
@@ -1213,6 +1275,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1213
1275
|
async registerImportMappings(mappings, rootSpecifiers) {
|
|
1214
1276
|
this.registry.getImportMetadataResolver().registerImportMappings(mappings, rootSpecifiers);
|
|
1215
1277
|
}
|
|
1278
|
+
|
|
1216
1279
|
/**
|
|
1217
1280
|
* Marks modules as "externally" loaded/provided (e.g. preloaded), so that the loader does not attempt to load them.
|
|
1218
1281
|
*
|
|
@@ -1227,4 +1290,4 @@ LWR.define('lwr/loader/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
1227
1290
|
|
|
1228
1291
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1229
1292
|
|
|
1230
|
-
});
|
|
1293
|
+
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/metrics/v/0_10_0-
|
|
1
|
+
LWR.define('lwr/metrics/v/0_10_0-alpha_7', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// Bootstrap / shim
|
|
4
4
|
const BOOTSTRAP_PREFIX = 'lwr.bootstrap.';
|
|
@@ -63,4 +63,4 @@ LWR.define('lwr/metrics/v/0_10_0-alpha_4', ['exports'], function (exports) { 'us
|
|
|
63
63
|
|
|
64
64
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
65
65
|
|
|
66
|
-
});
|
|
66
|
+
}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
LWR.define('lwr/profiler/v/0_10_0-
|
|
1
|
+
LWR.define('lwr/profiler/v/0_10_0-alpha_7', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
|
-
var Phase
|
|
4
|
-
(function (Phase) {
|
|
3
|
+
var Phase = /*#__PURE__*/function (Phase) {
|
|
5
4
|
Phase[Phase["Start"] = 0] = "Start";
|
|
6
5
|
Phase[Phase["End"] = 1] = "End";
|
|
7
|
-
|
|
6
|
+
return Phase;
|
|
7
|
+
}(Phase || {});
|
|
8
8
|
// Attach a custom dispatcher
|
|
9
9
|
let customDispatcher;
|
|
10
10
|
function attachDispatcher(dispatcher) {
|
|
@@ -65,4 +65,4 @@ LWR.define('lwr/profiler/v/0_10_0-alpha_4', ['exports'], function (exports) { 'u
|
|
|
65
65
|
|
|
66
66
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
67
67
|
|
|
68
|
-
});
|
|
68
|
+
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/vault/v/0_10_0-
|
|
1
|
+
LWR.define('lwr/vault/v/0_10_0-alpha_7', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// Credential vault for storing setters and subscribers for OAuth info
|
|
4
4
|
// This module is a SINGLETON and must be excluded from ESM bundling
|
|
@@ -18,4 +18,4 @@ LWR.define('lwr/vault/v/0_10_0-alpha_4', ['exports'], function (exports) { 'use
|
|
|
18
18
|
|
|
19
19
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
20
20
|
|
|
21
|
-
});
|
|
21
|
+
}));
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6
6
|
*/
|
|
7
|
-
/* LWR Error Shim v0.10.0-alpha.
|
|
7
|
+
/* LWR Error Shim v0.10.0-alpha.7 */
|
|
8
8
|
!function(){"use strict";if(!(globalThis.LWR&&globalThis.LWR.define)){const o=new Error("The LWR application failed to bootstrap");if(!globalThis.LWR||!globalThis.LWR.onError)throw o;globalThis.LWR.onError(o)}}();
|
|
9
|
+
//# sourceMappingURL=lwr-error-shim.js.map
|