@lwrjs/everywhere 0.13.0-alpha.8 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/ab29f69e1f2a5d9eb36f43b3ffe25b15/config.js +12 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_13_0/s/272183c0b6e02561b7c96a1b23473837/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{6_6_3/s/58be00f9ece0d8c0a817bddb6ae6b439 → 7_1_2/s/027fc9cd750ae64e43070ae2b597fad0}/lwc.js +231 -98
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_13_0-alpha_8 → 0_13_0}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_13_0-alpha_8/s/f30361ad8ff7af505bf4d465c8499181 → 0_13_0/s/d7186d4fbbc58762dab0d51cc1f0afb8}/lwr_init.js +21 -25
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_13_0-alpha_8/s/93ed759b78ad5d85a81258993da51177 → 0_13_0/s/a4ce234eff00f57b1a2d6e7bce8337de}/lwr_loader.js +17 -9
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_13_0-alpha_8/s/274c8343f810353bbad085a79709395f → 0_13_0/s/fb8c5dd340c69fdf7ded52d3eba633b9}/lwr_metrics.js +2 -2
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_13_0-alpha_8 → 0_13_0}/s/ec0fad0e38a96bb0b88c9f4553460347/lwr_preInit.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_13_0-alpha_8 → 0_13_0}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_13_0-alpha_8 → 0_13_0}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/0_13_0/lwr-error-shim.js +8 -0
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_13_0-alpha_8 → 0_13_0}/lwr-loader-shim.bundle.js +41 -22
- package/build/amd-client.js +1 -1
- package/build/assets/amd/lwr-everywhere-debug.js +26 -18
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +26 -18
- package/build/assets/core/lwr-everywhere-debug.js +22 -14
- package/build/assets/core/lwr-everywhere-min.js +2 -2
- package/build/assets/core/lwr-everywhere.js +22 -14
- package/build/assets/esm/lwr-everywhere-debug.js +1 -1
- package/build/assets/esm/lwr-everywhere-min.js +1 -1
- package/build/assets/esm/lwr-everywhere.js +1 -1
- package/build/esm-client.js +1 -1
- package/build/generate.d.ts +1 -1
- package/build/modules/lwr/everywhere/everywhere.js +1 -1
- package/build/modules/lwr/host/host.js +1 -1
- package/build/modules/lwr/setupLDS/setupLDS.js +1 -1
- package/package.json +10 -10
- package/src/amd-client.ts +2 -2
- package/src/esm-client.ts +2 -2
- package/src/generate.ts +1 -1
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/77b94097c2f300f6c2a2d64b775d196a/config.js +0 -12
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_13_0-alpha_8/s/272183c0b6e02561b7c96a1b23473837/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/0_13_0-alpha_8/lwr-error-shim.js +0 -8
@@ -1,10 +1,10 @@
|
|
1
|
-
LWR.define('lwr/everywhereAmd/v/0_13_0
|
1
|
+
LWR.define('lwr/everywhereAmd/v/0_13_0', ['exports', 'lwr/vault/v/0_13_0'], (function (exports, _0_13_0) { '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_13_0.getAuthInfo();
|
8
8
|
if (authInfo) {
|
9
9
|
return fetch(url, {
|
10
10
|
headers: {
|
@@ -53,7 +53,7 @@ LWR.define('lwr/everywhereAmd/v/0_13_0-alpha_8', ['exports', 'lwr/vault/v/0_13_0
|
|
53
53
|
function authenticate(authInfo) {
|
54
54
|
// Put OAuth info into the vault
|
55
55
|
if (authInfo) {
|
56
|
-
|
56
|
+
_0_13_0.setAuthInfo(authInfo);
|
57
57
|
}
|
58
58
|
}
|
59
59
|
|
@@ -1,16 +1,14 @@
|
|
1
|
-
LWR.define('lwr/init/v/0_13_0
|
2
|
-
|
3
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
1
|
+
LWR.define('lwr/init/v/0_13_0', ['exports', 'lwr/metrics/v/0_13_0', 'lwr/profiler/v/0_13_0', 'lwc/v/7_1_2'], (function (exports, _0_13_0$1, _0_13_0, _7_1_2) { 'use strict';
|
4
2
|
|
5
3
|
// <hydrateComponentProxy> - This code is removed in core
|
6
4
|
|
7
5
|
function hydrateComponentProxy(customElement, Ctor, props) {
|
8
|
-
|
6
|
+
_7_1_2.hydrateComponent(customElement, Ctor, props);
|
9
7
|
}
|
10
8
|
// </hydrateComponentProxy>
|
11
9
|
|
12
10
|
function initializeWebComponent(elementName, Ctor) {
|
13
|
-
return
|
11
|
+
return _7_1_2.createElement(elementName, {
|
14
12
|
is: Ctor
|
15
13
|
});
|
16
14
|
}
|
@@ -47,13 +45,13 @@ LWR.define('lwr/init/v/0_13_0-alpha_8', ['exports', 'lwr/metrics/v/0_13_0-alpha_
|
|
47
45
|
*/
|
48
46
|
function init(rootModules, serverData = {}) {
|
49
47
|
if (typeof customElements === 'undefined' || typeof document === 'undefined') {
|
50
|
-
|
51
|
-
id:
|
48
|
+
_0_13_0.logOperationStart({
|
49
|
+
id: _0_13_0$1.BOOTSTRAP_END
|
52
50
|
});
|
53
51
|
return;
|
54
52
|
}
|
55
|
-
|
56
|
-
id:
|
53
|
+
_0_13_0.logOperationStart({
|
54
|
+
id: _0_13_0$1.INIT
|
57
55
|
});
|
58
56
|
let index = 0;
|
59
57
|
for (const [specifier, ctor] of rootModules) {
|
@@ -61,8 +59,8 @@ LWR.define('lwr/init/v/0_13_0-alpha_8', ['exports', 'lwr/metrics/v/0_13_0-alpha_
|
|
61
59
|
|
62
60
|
// initialize and inject the root module into the LWR Root or DOM if it is missing
|
63
61
|
if (!document.body.querySelector(elementName)) {
|
64
|
-
|
65
|
-
id:
|
62
|
+
_0_13_0.logOperationStart({
|
63
|
+
id: _0_13_0$1.INIT_MODULE,
|
66
64
|
specifier,
|
67
65
|
specifierIndex: ++index
|
68
66
|
});
|
@@ -71,8 +69,8 @@ LWR.define('lwr/init/v/0_13_0-alpha_8', ['exports', 'lwr/metrics/v/0_13_0-alpha_
|
|
71
69
|
const component = initializeWebComponent(elementName, ctor);
|
72
70
|
const container = document.querySelector('[lwr-root]');
|
73
71
|
container ? container.appendChild(component) : document.body.appendChild(component);
|
74
|
-
|
75
|
-
id:
|
72
|
+
_0_13_0.logOperationEnd({
|
73
|
+
id: _0_13_0$1.INIT_MODULE,
|
76
74
|
specifier,
|
77
75
|
specifierIndex: index,
|
78
76
|
metadata: {
|
@@ -85,8 +83,8 @@ LWR.define('lwr/init/v/0_13_0-alpha_8', ['exports', 'lwr/metrics/v/0_13_0-alpha_
|
|
85
83
|
// the page has been rendered or SSR'd, and each component needs to initialized(or hydrated)
|
86
84
|
const elements = document.querySelectorAll(elementName);
|
87
85
|
for (const element of elements) {
|
88
|
-
|
89
|
-
id:
|
86
|
+
_0_13_0.logOperationStart({
|
87
|
+
id: _0_13_0$1.INIT_MODULE,
|
90
88
|
specifier,
|
91
89
|
specifierIndex: ++index
|
92
90
|
});
|
@@ -94,11 +92,9 @@ LWR.define('lwr/init/v/0_13_0-alpha_8', ['exports', 'lwr/metrics/v/0_13_0-alpha_
|
|
94
92
|
|
95
93
|
// hydrate SSR'd components
|
96
94
|
if (propsId) {
|
97
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
98
|
-
// @ts-ignore
|
99
95
|
hydrateComponentProxy(element, ctor, serverData[propsId] || {});
|
100
|
-
|
101
|
-
id:
|
96
|
+
_0_13_0.logOperationEnd({
|
97
|
+
id: _0_13_0$1.INIT_MODULE,
|
102
98
|
specifier,
|
103
99
|
specifierIndex: index,
|
104
100
|
metadata: {
|
@@ -136,8 +132,8 @@ LWR.define('lwr/init/v/0_13_0-alpha_8', ['exports', 'lwr/metrics/v/0_13_0-alpha_
|
|
136
132
|
if (parent) {
|
137
133
|
parent.replaceChild(component, element);
|
138
134
|
}
|
139
|
-
|
140
|
-
id:
|
135
|
+
_0_13_0.logOperationEnd({
|
136
|
+
id: _0_13_0$1.INIT_MODULE,
|
141
137
|
specifier,
|
142
138
|
specifierIndex: index,
|
143
139
|
metadata: {
|
@@ -146,11 +142,11 @@ LWR.define('lwr/init/v/0_13_0-alpha_8', ['exports', 'lwr/metrics/v/0_13_0-alpha_
|
|
146
142
|
});
|
147
143
|
}
|
148
144
|
}
|
149
|
-
|
150
|
-
id:
|
145
|
+
_0_13_0.logOperationEnd({
|
146
|
+
id: _0_13_0$1.INIT
|
151
147
|
});
|
152
|
-
|
153
|
-
id:
|
148
|
+
_0_13_0.logOperationStart({
|
149
|
+
id: _0_13_0$1.BOOTSTRAP_END
|
154
150
|
});
|
155
151
|
}
|
156
152
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/loader/v/0_13_0
|
1
|
+
LWR.define('lwr/loader/v/0_13_0', ['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_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
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.13.0
|
9
|
+
/* LWR Module Loader v0.13.0 */
|
10
10
|
const templateRegex = /\{([0-9]+)\}/g;
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
12
12
|
function templateString(template, args) {
|
@@ -25,7 +25,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
25
25
|
super();
|
26
26
|
this.message = generateErrorMessage(errorInfo, errorArgs);
|
27
27
|
}
|
28
|
-
/*LWC compiler
|
28
|
+
/*LWC compiler v7.1.2*/
|
29
29
|
}
|
30
30
|
function invariant(condition, errorInfo) {
|
31
31
|
if (!condition) {
|
@@ -127,6 +127,11 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
127
127
|
level: 0,
|
128
128
|
message: 'Error evaluating module "{0}", error was "{1}"'
|
129
129
|
});
|
130
|
+
const UNRESOLVEABLE_MAPPING_ERROR = Object.freeze({
|
131
|
+
code: 3022,
|
132
|
+
level: 0,
|
133
|
+
message: 'Unexpected undefined URI resolving mapping for "{0}"'
|
134
|
+
});
|
130
135
|
|
131
136
|
/* importMap errors */
|
132
137
|
Object.freeze({
|
@@ -304,7 +309,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
304
309
|
// Loader: modules
|
305
310
|
const LOADER_PREFIX = 'lwr.loader.';
|
306
311
|
const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
|
307
|
-
const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}
|
312
|
+
const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}module.dynamicLoad`;
|
308
313
|
const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
|
309
314
|
const MODULE_ERROR = `${LOADER_PREFIX}module.error`;
|
310
315
|
|
@@ -354,7 +359,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
354
359
|
return `${mappingEndpoint}${specifiers}${modifiers}`;
|
355
360
|
}
|
356
361
|
getBaseUrl() {
|
357
|
-
return this.config.baseUrl;
|
362
|
+
return this.config.baseUrl || '';
|
358
363
|
}
|
359
364
|
registerImportMappings(newImportMetadata, rootSpecifiers) {
|
360
365
|
if (!rootSpecifiers || rootSpecifiers.length === 0) {
|
@@ -391,7 +396,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
391
396
|
|
392
397
|
// Get URL from the local cache or return undefiend
|
393
398
|
getURI(specifier) {
|
394
|
-
return this.importURICache.has(specifier) ? resolveUrl(this.importURICache.get(specifier).uri, this.getBaseUrl()) : undefined;
|
399
|
+
return this.importURICache && this.importURICache.has(specifier) ? resolveUrl(this.importURICache.get(specifier).uri, this.getBaseUrl()) : undefined;
|
395
400
|
}
|
396
401
|
resolveLocal(specifier) {
|
397
402
|
const uri = this.getURI(specifier);
|
@@ -488,6 +493,9 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
488
493
|
// TODO For module invalidation with bundles it is recommended we have to send back all loaded root specified
|
489
494
|
// to ensure we detect all conflicts.
|
490
495
|
const uri = resolveUrl(this.buildMappingUrl(specifier), this.getBaseUrl());
|
496
|
+
if (!uri) {
|
497
|
+
throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR, [specifier]);
|
498
|
+
}
|
491
499
|
return globalThis.fetch(uri).then(res => {
|
492
500
|
if (!res.ok) {
|
493
501
|
this.config.profiler.logOperationStart({
|
@@ -609,7 +617,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
609
617
|
// swallow
|
610
618
|
}
|
611
619
|
const trusted = createPolicy('trusted', policyOptions);
|
612
|
-
/*! version: 0.22.
|
620
|
+
/*! version: 0.22.4 */
|
613
621
|
|
614
622
|
/* global console,process */
|
615
623
|
|
@@ -820,7 +828,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
820
828
|
const mod = this.namedDefineRegistry.get(name);
|
821
829
|
// Don't allow redefining a module.
|
822
830
|
if (mod && mod.defined) {
|
823
|
-
if (process.env.NODE_ENV !== 'production' && hasConsole) {
|
831
|
+
if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
|
824
832
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
825
833
|
console.warn(`Module redefine attempted: ${name}`);
|
826
834
|
}
|
@@ -1269,7 +1277,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
1269
1277
|
let baseUrl = config.baseUrl;
|
1270
1278
|
const mappingEndpoint = config.endpoints ? config.endpoints.uris.mapping : undefined;
|
1271
1279
|
let profiler = config.profiler;
|
1272
|
-
if (!mappingEndpoint) {
|
1280
|
+
if (!mappingEndpoint || !config.endpoints) {
|
1273
1281
|
throw new LoaderError(NO_MAPPING_URL);
|
1274
1282
|
}
|
1275
1283
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/metrics/v/0_13_0
|
1
|
+
LWR.define('lwr/metrics/v/0_13_0', ['exports'], (function (exports) { 'use strict';
|
2
2
|
|
3
3
|
// Bootstrap / shim
|
4
4
|
const BOOTSTRAP_PREFIX = 'lwr.bootstrap.';
|
@@ -18,7 +18,7 @@ LWR.define('lwr/metrics/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'u
|
|
18
18
|
const LOADER_PREFIX = 'lwr.loader.';
|
19
19
|
const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
|
20
20
|
const MODULE_DEFINE_COUNT = `${MODULE_DEFINE}.count`;
|
21
|
-
const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}
|
21
|
+
const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}module.dynamicLoad`;
|
22
22
|
const MODULE_DYNAMIC_LOAD_COUNT = `${MODULE_DYNAMIC_LOAD}.count`;
|
23
23
|
const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
|
24
24
|
const MODULE_FETCH_COUNT = `${MODULE_FETCH}.count`;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/preInit/v/0_13_0
|
1
|
+
LWR.define('lwr/preInit/v/0_13_0', ['exports'], (function (exports) { 'use strict';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* This module is called in the ABS module (app bootstrap module) to perform neccesary pre initialization steps for an LWR app.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/vault/v/0_13_0
|
1
|
+
LWR.define('lwr/vault/v/0_13_0', ['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
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2021, salesforce.com, inc.
|
3
|
+
* All rights reserved.
|
4
|
+
* SPDX-License-Identifier: MIT
|
5
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
6
|
+
*/
|
7
|
+
/* LWR Error Shim v0.13.0 */
|
8
|
+
!function(){"use strict";const o=globalThis;if(!(o.LWR&&o.LWR.define)){const r=new Error("The LWR application failed to bootstrap");if(!o.LWR||!o.LWR.onError)throw r;o.LWR.onError(r)}}();
|
@@ -4,7 +4,7 @@
|
|
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 Module Loader Shim v0.13.0
|
7
|
+
/* LWR Module Loader Shim v0.13.0 */
|
8
8
|
(function () {
|
9
9
|
'use strict';
|
10
10
|
|
@@ -116,6 +116,9 @@
|
|
116
116
|
const exports = {};
|
117
117
|
definition[2].call(null, exports);
|
118
118
|
const { Loader } = exports;
|
119
|
+
if (!Loader) {
|
120
|
+
throw new Error('Expected Loader class to be defined');
|
121
|
+
}
|
119
122
|
const loader = new Loader(config);
|
120
123
|
|
121
124
|
if (externalModules && externalModules.length) {
|
@@ -181,6 +184,7 @@
|
|
181
184
|
|
182
185
|
|
183
186
|
|
187
|
+
|
184
188
|
/* eslint-disable lwr/no-unguarded-apis */
|
185
189
|
const hasSetTimeout = typeof setTimeout === 'function';
|
186
190
|
const hasConsole = typeof console !== 'undefined';
|
@@ -205,10 +209,10 @@
|
|
205
209
|
// Parse configuration
|
206
210
|
this.global = global;
|
207
211
|
this.config = global.LWR ;
|
208
|
-
this.loaderSpecifier = 'lwr/loader/v/0_13_0
|
212
|
+
this.loaderSpecifier = 'lwr/loader/v/0_13_0';
|
209
213
|
|
210
214
|
// Set up error handler
|
211
|
-
this.errorHandler = this.config.onError;
|
215
|
+
this.errorHandler = this.config.onError ;
|
212
216
|
|
213
217
|
// Set up the temporary LWR.define function and customInit hook
|
214
218
|
const tempDefine = this.tempDefine.bind(this);
|
@@ -216,7 +220,7 @@
|
|
216
220
|
this.bootReady = this.config.autoBoot;
|
217
221
|
|
218
222
|
try {
|
219
|
-
this.createProfilerModule(
|
223
|
+
this.createProfilerModule(global.LWR.define);
|
220
224
|
customInit(
|
221
225
|
Object.freeze(this.config),
|
222
226
|
this.postCustomInit.bind(this),
|
@@ -234,6 +238,9 @@
|
|
234
238
|
|
235
239
|
// Return true if the app can be initialized
|
236
240
|
canInit() {
|
241
|
+
if (!this.config.requiredModules) {
|
242
|
+
throw new Error('Unexpected missing requiredModules');
|
243
|
+
}
|
237
244
|
// Initialize the app if:
|
238
245
|
// - bootReady: autoBoot is on OR customInit has finished
|
239
246
|
// - all required modules are defined
|
@@ -326,11 +333,11 @@
|
|
326
333
|
|
327
334
|
// Create a module out of the profiler
|
328
335
|
// Note: The profiler is also available as a module through lwc module resolution (see package.json)
|
329
|
-
createProfilerModule(
|
336
|
+
createProfilerModule(define) {
|
330
337
|
const exporter = (exports) => {
|
331
338
|
Object.assign(exports, { logOperationStart, logOperationEnd });
|
332
339
|
};
|
333
|
-
|
340
|
+
define('lwr/profiler/v/0_13_0', ['exports'], exporter);
|
334
341
|
}
|
335
342
|
|
336
343
|
// Set up the application globals, import map, root custom element...
|
@@ -338,14 +345,15 @@
|
|
338
345
|
const { bootstrapModule, rootComponent, rootComponents, serverData, endpoints, imports, index } =
|
339
346
|
this.config;
|
340
347
|
|
348
|
+
const importsObj = imports || {};
|
341
349
|
// Set global LWR.define to loader.define
|
342
350
|
this.global.LWR = Object.freeze({
|
343
351
|
define: loader.define.bind(loader),
|
344
352
|
rootComponent,
|
345
353
|
rootComponents,
|
346
|
-
serverData,
|
354
|
+
serverData: serverData || {},
|
347
355
|
endpoints,
|
348
|
-
imports:
|
356
|
+
imports: importsObj,
|
349
357
|
index: index || {},
|
350
358
|
env: this.global.LWR.env,
|
351
359
|
});
|
@@ -362,7 +370,10 @@
|
|
362
370
|
|
363
371
|
// Load the import mappings and application bootstrap module
|
364
372
|
loader
|
365
|
-
.registerImportMappings({ imports, index }, [
|
373
|
+
.registerImportMappings({ imports: importsObj, index }, [
|
374
|
+
bootstrapModule,
|
375
|
+
rootComponent ,
|
376
|
+
])
|
366
377
|
.then(() => {
|
367
378
|
if (!disableInitDefer) {
|
368
379
|
return this.waitForDOMContentLoaded();
|
@@ -403,14 +414,14 @@
|
|
403
414
|
// The loader module is ALWAYS required
|
404
415
|
const GLOBAL = globalThis ;
|
405
416
|
GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
|
406
|
-
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_0
|
407
|
-
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_0
|
417
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_0') < 0) {
|
418
|
+
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_0');
|
408
419
|
}
|
409
420
|
new LoaderShim(GLOBAL);
|
410
421
|
|
411
422
|
})();
|
412
423
|
|
413
|
-
LWR.define('lwr/loader/v/0_13_0
|
424
|
+
LWR.define('lwr/loader/v/0_13_0', ['exports'], (function (exports) { 'use strict';
|
414
425
|
|
415
426
|
const templateRegex = /\{([0-9]+)\}/g;
|
416
427
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -540,6 +551,11 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
540
551
|
level: 0,
|
541
552
|
message: 'Error evaluating module "{0}", error was "{1}"',
|
542
553
|
});
|
554
|
+
const UNRESOLVEABLE_MAPPING_ERROR = Object.freeze({
|
555
|
+
code: 3022,
|
556
|
+
level: 0,
|
557
|
+
message: 'Unexpected undefined URI resolving mapping for "{0}"',
|
558
|
+
});
|
543
559
|
|
544
560
|
/* importMap errors */
|
545
561
|
Object.freeze({
|
@@ -736,7 +752,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
736
752
|
// Loader: modules
|
737
753
|
const LOADER_PREFIX = 'lwr.loader.';
|
738
754
|
const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
|
739
|
-
const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}
|
755
|
+
const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}module.dynamicLoad`;
|
740
756
|
const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
|
741
757
|
const MODULE_ERROR = `${LOADER_PREFIX}module.error`;
|
742
758
|
|
@@ -790,7 +806,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
790
806
|
}
|
791
807
|
|
792
808
|
getBaseUrl() {
|
793
|
-
return this.config.baseUrl;
|
809
|
+
return this.config.baseUrl || '';
|
794
810
|
}
|
795
811
|
|
796
812
|
registerImportMappings(newImportMetadata, rootSpecifiers) {
|
@@ -831,8 +847,8 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
831
847
|
|
832
848
|
// Get URL from the local cache or return undefiend
|
833
849
|
getURI(specifier) {
|
834
|
-
return this.importURICache.has(specifier)
|
835
|
-
? resolveUrl(this.importURICache.get(specifier).uri, this.getBaseUrl())
|
850
|
+
return this.importURICache && this.importURICache.has(specifier)
|
851
|
+
? resolveUrl((this.importURICache.get(specifier) ).uri, this.getBaseUrl())
|
836
852
|
: undefined;
|
837
853
|
}
|
838
854
|
|
@@ -933,6 +949,9 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
933
949
|
// TODO For module invalidation with bundles it is recommended we have to send back all loaded root specified
|
934
950
|
// to ensure we detect all conflicts.
|
935
951
|
const uri = resolveUrl(this.buildMappingUrl(specifier), this.getBaseUrl());
|
952
|
+
if (!uri) {
|
953
|
+
throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR, [specifier]);
|
954
|
+
}
|
936
955
|
return globalThis.fetch(uri).then((res) => {
|
937
956
|
if (!res.ok) {
|
938
957
|
this.config.profiler.logOperationStart({ id: MAPPINGS_ERROR, specifier });
|
@@ -1053,7 +1072,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
1053
1072
|
// swallow
|
1054
1073
|
}
|
1055
1074
|
const trusted = createPolicy('trusted', policyOptions);
|
1056
|
-
/*! version: 0.22.
|
1075
|
+
/*! version: 0.22.4 */
|
1057
1076
|
|
1058
1077
|
/* global console,process */
|
1059
1078
|
|
@@ -1255,7 +1274,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
1255
1274
|
// eslint-disable-next-line no-await-in-loop
|
1256
1275
|
result = isResponseAPromise(response) ? await response : response;
|
1257
1276
|
}
|
1258
|
-
if (!this.isValidResolveResponse(result)) {
|
1277
|
+
if (!this.isValidResolveResponse(result )) {
|
1259
1278
|
throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
|
1260
1279
|
}
|
1261
1280
|
|
@@ -1345,7 +1364,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
1345
1364
|
const mod = this.namedDefineRegistry.get(name);
|
1346
1365
|
// Don't allow redefining a module.
|
1347
1366
|
if (mod && mod.defined) {
|
1348
|
-
if (process.env.NODE_ENV !== 'production' && hasConsole) {
|
1367
|
+
if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
|
1349
1368
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
1350
1369
|
console.warn(`Module redefine attempted: ${name}`);
|
1351
1370
|
}
|
@@ -1386,7 +1405,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
1386
1405
|
// eslint-disable-next-line lwr/no-unguarded-apis, no-undef
|
1387
1406
|
timer = setTimeout(() => {
|
1388
1407
|
reject(new LoaderError(MODULE_LOAD_TIMEOUT, [id]));
|
1389
|
-
}, MODULE_LOAD_TIMEOUT_TIMER);
|
1408
|
+
}, MODULE_LOAD_TIMEOUT_TIMER) ;
|
1390
1409
|
}).finally(() => {
|
1391
1410
|
// eslint-disable-next-line lwr/no-unguarded-apis, no-undef
|
1392
1411
|
clearTimeout(timer);
|
@@ -1824,7 +1843,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
1824
1843
|
const mappingEndpoint = config.endpoints ? config.endpoints.uris.mapping : undefined;
|
1825
1844
|
let profiler = config.profiler;
|
1826
1845
|
|
1827
|
-
if (!mappingEndpoint) {
|
1846
|
+
if (!mappingEndpoint || !config.endpoints) {
|
1828
1847
|
throw new LoaderError(NO_MAPPING_URL);
|
1829
1848
|
}
|
1830
1849
|
|
@@ -1869,7 +1888,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
1869
1888
|
this.services = Object.freeze({
|
1870
1889
|
addLoaderPlugin: this.registry.addLoaderPlugin.bind(this.registry),
|
1871
1890
|
handleStaleModule: this.registry.registerHandleStaleModuleHook.bind(this.registry),
|
1872
|
-
appMetadata: config.appMetadata,
|
1891
|
+
appMetadata: config.appMetadata ,
|
1873
1892
|
});
|
1874
1893
|
}
|
1875
1894
|
|
package/build/amd-client.js
CHANGED