@lwrjs/everywhere 0.13.0-alpha.2 → 0.13.0-alpha.21

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.
Files changed (34) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/7cab5b5abf0ca3e4441d73f126db9867/config.js +12 -0
  2. 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_21/s/272183c0b6e02561b7c96a1b23473837/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{6_6_1/s/eeee3bb1f188f86a6a28e9d5c983706c → 7_0_0/s/ed008935d51f911e7bc67e4820765193}/lwc.js +193 -72
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_13_0-alpha_2 → 0_13_0-alpha_21}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_13_0-alpha_2/s/f30361ad8ff7af505bf4d465c8499181 → 0_13_0-alpha_21/s/d7186d4fbbc58762dab0d51cc1f0afb8}/lwr_init.js +21 -25
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_13_0-alpha_2/s/e307ee0231427b79178dc8789d2591fc → 0_13_0-alpha_21/s/12dfed2ad9e2186068113cd7fbc9c605}/lwr_loader.js +17 -10
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_13_0-alpha_2/s/274c8343f810353bbad085a79709395f → 0_13_0-alpha_21/s/fb8c5dd340c69fdf7ded52d3eba633b9}/lwr_metrics.js +2 -2
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_13_0-alpha_2 → 0_13_0-alpha_21}/s/ec0fad0e38a96bb0b88c9f4553460347/lwr_preInit.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_13_0-alpha_2 → 0_13_0-alpha_21}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_13_0-alpha_2 → 0_13_0-alpha_21}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/0_13_0-alpha_21/lwr-error-shim.js +8 -0
  12. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_13_0-alpha_2 → 0_13_0-alpha_21}/lwr-loader-shim.bundle.js +45 -23
  13. package/build/amd-client.js +1 -1
  14. package/build/assets/amd/lwr-everywhere-debug.js +25 -18
  15. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  16. package/build/assets/amd/lwr-everywhere.js +25 -18
  17. package/build/assets/core/lwr-everywhere-debug.js +21 -14
  18. package/build/assets/core/lwr-everywhere-min.js +2 -2
  19. package/build/assets/core/lwr-everywhere.js +21 -14
  20. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  21. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  22. package/build/assets/esm/lwr-everywhere.js +1 -1
  23. package/build/esm-client.js +1 -1
  24. package/build/generate.d.ts +1 -1
  25. package/build/modules/lwr/everywhere/everywhere.js +1 -1
  26. package/build/modules/lwr/host/host.js +1 -1
  27. package/build/modules/lwr/setupLDS/setupLDS.js +1 -1
  28. package/package.json +10 -10
  29. package/src/amd-client.ts +2 -2
  30. package/src/esm-client.ts +2 -2
  31. package/src/generate.ts +1 -1
  32. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/86e5b35c91b01b4b7df42aded40a3e5d/config.js +0 -12
  33. 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_2/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
  34. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/0_13_0-alpha_2/lwr-error-shim.js +0 -8
@@ -1,16 +1,14 @@
1
- LWR.define('lwr/init/v/0_13_0-alpha_2', ['exports', 'lwr/metrics/v/0_13_0-alpha_2', 'lwr/profiler/v/0_13_0-alpha_2', 'lwc/v/6_6_1'], (function (exports, _0_13_0Alpha_2$1, _0_13_0Alpha_2, _6_6_1) { 'use strict';
2
-
3
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1
+ LWR.define('lwr/init/v/0_13_0-alpha_21', ['exports', 'lwr/metrics/v/0_13_0-alpha_21', 'lwr/profiler/v/0_13_0-alpha_21', 'lwc/v/7_0_0'], (function (exports, _0_13_0Alpha_21$1, _0_13_0Alpha_21, _7_0_0) { 'use strict';
4
2
 
5
3
  // <hydrateComponentProxy> - This code is removed in core
6
4
 
7
5
  function hydrateComponentProxy(customElement, Ctor, props) {
8
- _6_6_1.hydrateComponent(customElement, Ctor, props);
6
+ _7_0_0.hydrateComponent(customElement, Ctor, props);
9
7
  }
10
8
  // </hydrateComponentProxy>
11
9
 
12
10
  function initializeWebComponent(elementName, Ctor) {
13
- return _6_6_1.createElement(elementName, {
11
+ return _7_0_0.createElement(elementName, {
14
12
  is: Ctor
15
13
  });
16
14
  }
@@ -47,13 +45,13 @@ LWR.define('lwr/init/v/0_13_0-alpha_2', ['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
- _0_13_0Alpha_2.logOperationStart({
51
- id: _0_13_0Alpha_2$1.BOOTSTRAP_END
48
+ _0_13_0Alpha_21.logOperationStart({
49
+ id: _0_13_0Alpha_21$1.BOOTSTRAP_END
52
50
  });
53
51
  return;
54
52
  }
55
- _0_13_0Alpha_2.logOperationStart({
56
- id: _0_13_0Alpha_2$1.INIT
53
+ _0_13_0Alpha_21.logOperationStart({
54
+ id: _0_13_0Alpha_21$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_2', ['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
- _0_13_0Alpha_2.logOperationStart({
65
- id: _0_13_0Alpha_2$1.INIT_MODULE,
62
+ _0_13_0Alpha_21.logOperationStart({
63
+ id: _0_13_0Alpha_21$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_2', ['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
- _0_13_0Alpha_2.logOperationEnd({
75
- id: _0_13_0Alpha_2$1.INIT_MODULE,
72
+ _0_13_0Alpha_21.logOperationEnd({
73
+ id: _0_13_0Alpha_21$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_2', ['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
- _0_13_0Alpha_2.logOperationStart({
89
- id: _0_13_0Alpha_2$1.INIT_MODULE,
86
+ _0_13_0Alpha_21.logOperationStart({
87
+ id: _0_13_0Alpha_21$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_2', ['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
- _0_13_0Alpha_2.logOperationEnd({
101
- id: _0_13_0Alpha_2$1.INIT_MODULE,
96
+ _0_13_0Alpha_21.logOperationEnd({
97
+ id: _0_13_0Alpha_21$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_2', ['exports', 'lwr/metrics/v/0_13_0-alpha_
136
132
  if (parent) {
137
133
  parent.replaceChild(component, element);
138
134
  }
139
- _0_13_0Alpha_2.logOperationEnd({
140
- id: _0_13_0Alpha_2$1.INIT_MODULE,
135
+ _0_13_0Alpha_21.logOperationEnd({
136
+ id: _0_13_0Alpha_21$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_2', ['exports', 'lwr/metrics/v/0_13_0-alpha_
146
142
  });
147
143
  }
148
144
  }
149
- _0_13_0Alpha_2.logOperationEnd({
150
- id: _0_13_0Alpha_2$1.INIT
145
+ _0_13_0Alpha_21.logOperationEnd({
146
+ id: _0_13_0Alpha_21$1.INIT
151
147
  });
152
- _0_13_0Alpha_2.logOperationStart({
153
- id: _0_13_0Alpha_2$1.BOOTSTRAP_END
148
+ _0_13_0Alpha_21.logOperationStart({
149
+ id: _0_13_0Alpha_21$1.BOOTSTRAP_END
154
150
  });
155
151
  }
156
152
 
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/loader/v/0_13_0-alpha_21', ['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_2', ['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-alpha.2 */
9
+ /* LWR Module Loader v0.13.0-alpha.21 */
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_2', ['exports'], (function (exports) { 'us
25
25
  super();
26
26
  this.message = generateErrorMessage(errorInfo, errorArgs);
27
27
  }
28
- /*LWC compiler v6.6.1*/
28
+ /*LWC compiler v7.0.0*/
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_2', ['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_2', ['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}moduleRegistry.dynamicLoad`;
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_2', ['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_2', ['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_2', ['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_2', ['exports'], (function (exports) { 'us
609
617
  // swallow
610
618
  }
611
619
  const trusted = createPolicy('trusted', policyOptions);
612
- /*! version: 0.22.1 */
620
+ /*! version: 0.22.3 */
613
621
 
614
622
  /* global console,process */
615
623
 
@@ -1269,7 +1277,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['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
 
@@ -1315,8 +1323,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
1315
1323
  this.services = Object.freeze({
1316
1324
  addLoaderPlugin: this.registry.addLoaderPlugin.bind(this.registry),
1317
1325
  handleStaleModule: this.registry.registerHandleStaleModuleHook.bind(this.registry),
1318
- appMetadata: config.appMetadata,
1319
- serverData: config.serverData || {}
1326
+ appMetadata: config.appMetadata
1320
1327
  });
1321
1328
  }
1322
1329
 
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/metrics/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/metrics/v/0_13_0-alpha_21', ['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_2', ['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}moduleRegistry.dynamicLoad`;
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-alpha_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/preInit/v/0_13_0-alpha_21', ['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/profiler/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/profiler/v/0_13_0-alpha_21', ['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  var Phase = /*#__PURE__*/function (Phase) {
4
4
  Phase[Phase["Start"] = 0] = "Start";
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/vault/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/vault/v/0_13_0-alpha_21', ['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-alpha.21 */
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-alpha.2 */
7
+ /* LWR Module Loader Shim v0.13.0-alpha.21 */
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-alpha_2';
212
+ this.loaderSpecifier = 'lwr/loader/v/0_13_0-alpha_21';
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(this.config);
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
@@ -269,6 +276,11 @@
269
276
  postCustomInit() {
270
277
  this.bootReady = true;
271
278
  if (this.canInit()) {
279
+ if (hasSetTimeout) {
280
+ // requiredModules are defined, clear watchdog timer
281
+ // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
282
+ clearTimeout(this.watchdogTimerId);
283
+ }
272
284
  this.initApp();
273
285
  }
274
286
  }
@@ -280,7 +292,6 @@
280
292
  endpoints: this.config.endpoints,
281
293
  baseUrl: this.config.baseUrl,
282
294
  profiler: { logOperationStart, logOperationEnd },
283
- serverData: this.config.serverData,
284
295
  // TODO: can be removed following https://github.com/salesforce-experience-platform-emu/lwr/issues/1087
285
296
  appMetadata: {
286
297
  appId: this.config.appId,
@@ -322,11 +333,11 @@
322
333
 
323
334
  // Create a module out of the profiler
324
335
  // Note: The profiler is also available as a module through lwc module resolution (see package.json)
325
- createProfilerModule(globalLWR) {
336
+ createProfilerModule(define) {
326
337
  const exporter = (exports) => {
327
338
  Object.assign(exports, { logOperationStart, logOperationEnd });
328
339
  };
329
- globalLWR.define('lwr/profiler/v/0_13_0-alpha_2', ['exports'], exporter);
340
+ define('lwr/profiler/v/0_13_0-alpha_21', ['exports'], exporter);
330
341
  }
331
342
 
332
343
  // Set up the application globals, import map, root custom element...
@@ -334,14 +345,15 @@
334
345
  const { bootstrapModule, rootComponent, rootComponents, serverData, endpoints, imports, index } =
335
346
  this.config;
336
347
 
348
+ const importsObj = imports || {};
337
349
  // Set global LWR.define to loader.define
338
350
  this.global.LWR = Object.freeze({
339
351
  define: loader.define.bind(loader),
340
352
  rootComponent,
341
353
  rootComponents,
342
- serverData,
354
+ serverData: serverData || {},
343
355
  endpoints,
344
- imports: imports || {},
356
+ imports: importsObj,
345
357
  index: index || {},
346
358
  env: this.global.LWR.env,
347
359
  });
@@ -358,7 +370,10 @@
358
370
 
359
371
  // Load the import mappings and application bootstrap module
360
372
  loader
361
- .registerImportMappings({ imports, index }, [bootstrapModule, rootComponent])
373
+ .registerImportMappings({ imports: importsObj, index }, [
374
+ bootstrapModule,
375
+ rootComponent ,
376
+ ])
362
377
  .then(() => {
363
378
  if (!disableInitDefer) {
364
379
  return this.waitForDOMContentLoaded();
@@ -399,14 +414,14 @@
399
414
  // The loader module is ALWAYS required
400
415
  const GLOBAL = globalThis ;
401
416
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
402
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_0-alpha_2') < 0) {
403
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_0-alpha_2');
417
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_0-alpha_21') < 0) {
418
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_0-alpha_21');
404
419
  }
405
420
  new LoaderShim(GLOBAL);
406
421
 
407
422
  })();
408
423
 
409
- LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'use strict';
424
+ LWR.define('lwr/loader/v/0_13_0-alpha_21', ['exports'], (function (exports) { 'use strict';
410
425
 
411
426
  const templateRegex = /\{([0-9]+)\}/g;
412
427
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -536,6 +551,11 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
536
551
  level: 0,
537
552
  message: 'Error evaluating module "{0}", error was "{1}"',
538
553
  });
554
+ const UNRESOLVEABLE_MAPPING_ERROR = Object.freeze({
555
+ code: 3022,
556
+ level: 0,
557
+ message: 'Unexpected undefined URI resolving mapping for "{0}"',
558
+ });
539
559
 
540
560
  /* importMap errors */
541
561
  Object.freeze({
@@ -732,7 +752,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
732
752
  // Loader: modules
733
753
  const LOADER_PREFIX = 'lwr.loader.';
734
754
  const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
735
- const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}moduleRegistry.dynamicLoad`;
755
+ const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}module.dynamicLoad`;
736
756
  const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
737
757
  const MODULE_ERROR = `${LOADER_PREFIX}module.error`;
738
758
 
@@ -786,7 +806,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
786
806
  }
787
807
 
788
808
  getBaseUrl() {
789
- return this.config.baseUrl;
809
+ return this.config.baseUrl || '';
790
810
  }
791
811
 
792
812
  registerImportMappings(newImportMetadata, rootSpecifiers) {
@@ -827,8 +847,8 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
827
847
 
828
848
  // Get URL from the local cache or return undefiend
829
849
  getURI(specifier) {
830
- return this.importURICache.has(specifier)
831
- ? 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())
832
852
  : undefined;
833
853
  }
834
854
 
@@ -929,6 +949,9 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
929
949
  // TODO For module invalidation with bundles it is recommended we have to send back all loaded root specified
930
950
  // to ensure we detect all conflicts.
931
951
  const uri = resolveUrl(this.buildMappingUrl(specifier), this.getBaseUrl());
952
+ if (!uri) {
953
+ throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR, [specifier]);
954
+ }
932
955
  return globalThis.fetch(uri).then((res) => {
933
956
  if (!res.ok) {
934
957
  this.config.profiler.logOperationStart({ id: MAPPINGS_ERROR, specifier });
@@ -1049,7 +1072,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
1049
1072
  // swallow
1050
1073
  }
1051
1074
  const trusted = createPolicy('trusted', policyOptions);
1052
- /*! version: 0.22.1 */
1075
+ /*! version: 0.22.3 */
1053
1076
 
1054
1077
  /* global console,process */
1055
1078
 
@@ -1251,7 +1274,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
1251
1274
  // eslint-disable-next-line no-await-in-loop
1252
1275
  result = isResponseAPromise(response) ? await response : response;
1253
1276
  }
1254
- if (!this.isValidResolveResponse(result)) {
1277
+ if (!this.isValidResolveResponse(result )) {
1255
1278
  throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
1256
1279
  }
1257
1280
 
@@ -1382,7 +1405,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
1382
1405
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1383
1406
  timer = setTimeout(() => {
1384
1407
  reject(new LoaderError(MODULE_LOAD_TIMEOUT, [id]));
1385
- }, MODULE_LOAD_TIMEOUT_TIMER);
1408
+ }, MODULE_LOAD_TIMEOUT_TIMER) ;
1386
1409
  }).finally(() => {
1387
1410
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1388
1411
  clearTimeout(timer);
@@ -1820,7 +1843,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
1820
1843
  const mappingEndpoint = config.endpoints ? config.endpoints.uris.mapping : undefined;
1821
1844
  let profiler = config.profiler;
1822
1845
 
1823
- if (!mappingEndpoint) {
1846
+ if (!mappingEndpoint || !config.endpoints) {
1824
1847
  throw new LoaderError(NO_MAPPING_URL);
1825
1848
  }
1826
1849
 
@@ -1865,8 +1888,7 @@ LWR.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (function (exports) { 'us
1865
1888
  this.services = Object.freeze({
1866
1889
  addLoaderPlugin: this.registry.addLoaderPlugin.bind(this.registry),
1867
1890
  handleStaleModule: this.registry.registerHandleStaleModuleHook.bind(this.registry),
1868
- appMetadata: config.appMetadata,
1869
- serverData: config.serverData || {},
1891
+ appMetadata: config.appMetadata ,
1870
1892
  });
1871
1893
  }
1872
1894
 
@@ -1,4 +1,4 @@
1
- import { getConfiguration } from './utils';
1
+ import { getConfiguration } from './utils.js';
2
2
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
3
  // @ts-ignore: Use LWC module resolver
4
4
  import { Loader } from 'lwr/loader';
@@ -20,7 +20,7 @@ function getConfiguration(options) {
20
20
  : `${ORIGIN}${PREFIX}/module/${format}/${POSTFIX}/mi/`;
21
21
 
22
22
  // Component specifiers and URIs
23
- const BOOT_MODULE = `lwr/everywhere${format === 'esm' ? 'Esm' : 'Amd'}/v/0_13_0-alpha_2`;
23
+ const BOOT_MODULE = `lwr/everywhere${format === 'esm' ? 'Esm' : 'Amd'}/v/0_13_0-alpha_21`;
24
24
  const BOOT_URI = `${ENDPOINT}${encodeURIComponent(BOOT_MODULE)}/latest${debug ? '?debug' : ''}`;
25
25
 
26
26
  // Client Bootstrap Config
@@ -52,7 +52,7 @@ function getConfiguration(options) {
52
52
  * SPDX-License-Identifier: MIT
53
53
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
54
54
  */
55
- /* LWR Module Loader v0.13.0-alpha.2 */
55
+ /* LWR Module Loader v0.13.0-alpha.21 */
56
56
  const templateRegex = /\{([0-9]+)\}/g;
57
57
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
58
  function templateString(template, args) {
@@ -181,6 +181,11 @@ const EXPORTER_ERROR = Object.freeze({
181
181
  level: 0,
182
182
  message: 'Error evaluating module "{0}", error was "{1}"',
183
183
  });
184
+ const UNRESOLVEABLE_MAPPING_ERROR = Object.freeze({
185
+ code: 3022,
186
+ level: 0,
187
+ message: 'Unexpected undefined URI resolving mapping for "{0}"',
188
+ });
184
189
 
185
190
  /* importMap errors */
186
191
  Object.freeze({
@@ -377,7 +382,7 @@ if (hasDocument) {
377
382
  // Loader: modules
378
383
  const LOADER_PREFIX = 'lwr.loader.';
379
384
  const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
380
- const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}moduleRegistry.dynamicLoad`;
385
+ const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}module.dynamicLoad`;
381
386
  const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
382
387
  const MODULE_ERROR = `${LOADER_PREFIX}module.error`;
383
388
 
@@ -431,7 +436,7 @@ class ImportMetadataResolver {
431
436
  }
432
437
 
433
438
  getBaseUrl() {
434
- return this.config.baseUrl;
439
+ return this.config.baseUrl || '';
435
440
  }
436
441
 
437
442
  registerImportMappings(newImportMetadata, rootSpecifiers) {
@@ -472,8 +477,8 @@ class ImportMetadataResolver {
472
477
 
473
478
  // Get URL from the local cache or return undefiend
474
479
  getURI(specifier) {
475
- return this.importURICache.has(specifier)
476
- ? resolveUrl(this.importURICache.get(specifier).uri, this.getBaseUrl())
480
+ return this.importURICache && this.importURICache.has(specifier)
481
+ ? resolveUrl((this.importURICache.get(specifier) ).uri, this.getBaseUrl())
477
482
  : undefined;
478
483
  }
479
484
 
@@ -574,6 +579,9 @@ class ImportMetadataResolver {
574
579
  // TODO For module invalidation with bundles it is recommended we have to send back all loaded root specified
575
580
  // to ensure we detect all conflicts.
576
581
  const uri = resolveUrl(this.buildMappingUrl(specifier), this.getBaseUrl());
582
+ if (!uri) {
583
+ throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR, [specifier]);
584
+ }
577
585
  return globalThis.fetch(uri).then((res) => {
578
586
  if (!res.ok) {
579
587
  this.config.profiler.logOperationStart({ id: MAPPINGS_ERROR, specifier });
@@ -694,7 +702,7 @@ try {
694
702
  // swallow
695
703
  }
696
704
  const trusted = createPolicy('trusted', policyOptions);
697
- /*! version: 0.22.1 */
705
+ /*! version: 0.22.3 */
698
706
 
699
707
  /* global console,process */
700
708
 
@@ -896,7 +904,7 @@ class ModuleRegistry {
896
904
  // eslint-disable-next-line no-await-in-loop
897
905
  result = isResponseAPromise(response) ? await response : response;
898
906
  }
899
- if (!this.isValidResolveResponse(result)) {
907
+ if (!this.isValidResolveResponse(result )) {
900
908
  throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
901
909
  }
902
910
 
@@ -1027,7 +1035,7 @@ class ModuleRegistry {
1027
1035
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1028
1036
  timer = setTimeout(() => {
1029
1037
  reject(new LoaderError(MODULE_LOAD_TIMEOUT, [id]));
1030
- }, MODULE_LOAD_TIMEOUT_TIMER);
1038
+ }, MODULE_LOAD_TIMEOUT_TIMER) ;
1031
1039
  }).finally(() => {
1032
1040
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1033
1041
  clearTimeout(timer);
@@ -1465,7 +1473,7 @@ class Loader {
1465
1473
  const mappingEndpoint = config.endpoints ? config.endpoints.uris.mapping : undefined;
1466
1474
  let profiler = config.profiler;
1467
1475
 
1468
- if (!mappingEndpoint) {
1476
+ if (!mappingEndpoint || !config.endpoints) {
1469
1477
  throw new LoaderError(NO_MAPPING_URL);
1470
1478
  }
1471
1479
 
@@ -1510,8 +1518,7 @@ class Loader {
1510
1518
  this.services = Object.freeze({
1511
1519
  addLoaderPlugin: this.registry.addLoaderPlugin.bind(this.registry),
1512
1520
  handleStaleModule: this.registry.registerHandleStaleModuleHook.bind(this.registry),
1513
- appMetadata: config.appMetadata,
1514
- serverData: config.serverData || {},
1521
+ appMetadata: config.appMetadata ,
1515
1522
  });
1516
1523
  }
1517
1524
 
@@ -1598,7 +1605,7 @@ const { bootstrapModule, endpoints, baseUrl, imports, index } = configuration;
1598
1605
 
1599
1606
  // Initialize the AMD loader (its code is bundled into the LWR Everywhere module)
1600
1607
  const loader = new Loader({ endpoints, baseUrl });
1601
- loader.define('lwr/loader/v/0_13_0-alpha_2', ['exports'], (exports) => {
1608
+ loader.define('lwr/loader/v/0_13_0-alpha_21', ['exports'], (exports) => {
1602
1609
  Object.assign(exports, {
1603
1610
  define: loader.define.bind(loader),
1604
1611
  load: loader.load.bind(loader),
@@ -1608,12 +1615,12 @@ await loader.registerImportMappings({ imports, index }, [bootstrapModule]);
1608
1615
  (globalThis ).LWR = Object.freeze({ define: loader.define.bind(loader) });
1609
1616
 
1610
1617
  // Define preload modules (ie: ABS, vault, etc) BEFORE loading them
1611
- LWR.define('lwr/everywhereAmd/v/0_13_0-alpha_2', ['exports', 'lwr/vault/v/0_13_0-alpha_2'], (function (exports, _0_13_0Alpha_2) {
1618
+ LWR.define('lwr/everywhereAmd/v/0_13_0-alpha_21', ['exports', 'lwr/vault/v/0_13_0-alpha_21'], (function (exports, _0_13_0Alpha_21) {
1612
1619
  // IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
1613
1620
 
1614
1621
  // Do an OAuthed fetch
1615
1622
  async function authFetch(url, accept = 'javascript') {
1616
- const authInfo = _0_13_0Alpha_2.getAuthInfo();
1623
+ const authInfo = _0_13_0Alpha_21.getAuthInfo();
1617
1624
  if (authInfo) {
1618
1625
  return fetch(url, {
1619
1626
  headers: {
@@ -1662,7 +1669,7 @@ LWR.define('lwr/everywhereAmd/v/0_13_0-alpha_2', ['exports', 'lwr/vault/v/0_13_0
1662
1669
  function authenticate(authInfo) {
1663
1670
  // Put OAuth info into the vault
1664
1671
  if (authInfo) {
1665
- _0_13_0Alpha_2.setAuthInfo(authInfo);
1672
+ _0_13_0Alpha_21.setAuthInfo(authInfo);
1666
1673
  }
1667
1674
  }
1668
1675
 
@@ -1672,7 +1679,7 @@ LWR.define('lwr/everywhereAmd/v/0_13_0-alpha_2', ['exports', 'lwr/vault/v/0_13_0
1672
1679
  Object.defineProperty(exports, '__esModule', { value: true });
1673
1680
 
1674
1681
  }));
1675
- LWR.define('lwr/vault/v/0_13_0-alpha_2', ['exports'], (function (exports) {
1682
+ LWR.define('lwr/vault/v/0_13_0-alpha_21', ['exports'], (function (exports) {
1676
1683
  // Credential vault for storing setters and subscribers for OAuth info
1677
1684
  // This module is a SINGLETON and must be excluded from ESM bundling
1678
1685
 
@@ -1696,7 +1703,7 @@ LWR.define('lwr/vault/v/0_13_0-alpha_2', ['exports'], (function (exports) {
1696
1703
 
1697
1704
  // Set up the AMD loader hooks for OAuth
1698
1705
  const { initAmd, authenticate } = await loader.load(bootstrapModule);
1699
- initAmd(loader.services, _optionalChain([endpoints, 'optionalAccess', _ => _.uris, 'access', _2 => _2.mapping]), '0_13_0-alpha_2');
1706
+ initAmd(loader.services, _optionalChain([endpoints, 'optionalAccess', _ => _.uris, 'access', _2 => _2.mapping]), '0_13_0-alpha_21');
1700
1707
 
1701
1708
  // Wrap the createComponent API to allow proper ordering of module definitions:
1702
1709
  // 1. LWRE module bundle (this): lwr/loader, lwr/everywhereAmd, lwr/vault