@lwrjs/everywhere 0.20.0 → 0.20.1

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 (22) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/5f5f30daf4b4f9fcd8cc6fe819066c4f/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_20_0 → 0_20_1}/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js +5 -5
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_20_0 → 0_20_1}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_20_0 → 0_20_1}/s/ba081ae41570981325062377381a1ea2/lwr_init.js +19 -19
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_20_0/s/9685b1c83c0f9ac9a036bb005137e44b → 0_20_1/s/9aad4654eb8dafc23877b4fb647c6ade}/lwr_loader.js +55 -3
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_20_0 → 0_20_1}/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js +1 -1
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_20_0 → 0_20_1}/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js +1 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_20_0 → 0_20_1}/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_20_0 → 0_20_1}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_20_0 → 0_20_1}/lwr-error-shim.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_20_0 → 0_20_1}/lwr-loader-shim.bundle.js +56 -8
  12. package/build/assets/amd/lwr-everywhere-debug.js +57 -10
  13. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  14. package/build/assets/amd/lwr-everywhere.js +57 -10
  15. package/build/assets/core/lwr-everywhere-debug.js +53 -6
  16. package/build/assets/core/lwr-everywhere-min.js +2 -2
  17. package/build/assets/core/lwr-everywhere.js +53 -6
  18. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  19. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  20. package/build/assets/esm/lwr-everywhere.js +1 -1
  21. package/package.json +6 -6
  22. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/d548adb08f5642c8ee0561e3a6034101/config.js +0 -12
@@ -0,0 +1,12 @@
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_20_1","autoBoot":true,"imports":{"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_20_1/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_1"],"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_20_1/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js":["lwr/preInit/v/0_20_1"],"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_20_1/s/ba081ae41570981325062377381a1ea2/lwr_init.js":["lwr/init/v/0_20_1"],"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_20_1/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js":["lwr/metrics/v/0_20_1"],"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F8_20_1/s/13f9f9934fd3a3c9f52760160b464d00/lwc.js":["lwc/v/8_20_1"],"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_20_1/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js":["lwr/everywhereAmd/v/0_20_1"],"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_20_1/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js":["lwr/vault/v/0_20_1"]},"index":{"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_1":"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_20_1/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js","lwr/preInit/v/0_20_1":"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_20_1/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js","lwr/init/v/0_20_1":"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_20_1/s/ba081ae41570981325062377381a1ea2/lwr_init.js","lwr/metrics/v/0_20_1":"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_20_1/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js","lwc/v/8_20_1":"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F8_20_1/s/13f9f9934fd3a3c9f52760160b464d00/lwc.js","lwr/everywhereAmd/v/0_20_1":"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_20_1/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js","lwr/vault/v/0_20_1":"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_20_1/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js"},"rootComponents":["lwr/everywhereAmd/v/0_20_1"],"serverData":{},"requiredModules":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_1"],"preloadModules":["lwr/preInit/v/0_20_1","lwr/init/v/0_20_1","lwr/metrics/v/0_20_1","lwc/v/8_20_1","lwr/everywhereAmd/v/0_20_1"],"endpoints":{"uris":{"mapping":"/1/mapping/amd/1/l/en-US/mp/"}}});
5
+ globalThis.LWR = {...globalThis.LWR, env: {"SSR":false,"SSREnabled":false,"basePath":"","locale":"en-US","assetBasePath":"","uiBasePath":""}};
6
+ globalThis.process={...globalThis.process,env:{...globalThis.process?.env,...{"NODE_ENV":"compat"}}};
7
+ globalThis.lwcRuntimeFlags = { ENABLE_MIXED_SHADOW_MODE: false, ENABLE_WIRE_SYNC_EMIT: false };
8
+ // Appended by Static Site Generator
9
+ if (!globalThis.LWR.imports) { globalThis.LWR.imports = {}; }
10
+ Object.assign(globalThis.LWR.imports, {"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_20_1/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js":["lwr/profiler/v/0_20_1"],"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_20_1/s/9aad4654eb8dafc23877b4fb647c6ade/lwr_loader.js":["lwr/loader/v/0_20_1"]})
11
+ if (!globalThis.LWR.index) { globalThis.LWR.index = {}; }
12
+ Object.assign(globalThis.LWR.index, {"lwr/profiler/v/0_20_1":"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_20_1/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js","lwr/loader/v/0_20_1":"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_20_1/s/9aad4654eb8dafc23877b4fb647c6ade/lwr_loader.js"})
@@ -1,15 +1,15 @@
1
- LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_0', ['lwr/loader/v/0_20_0', 'lwr/preInit/v/0_20_0', 'lwr/init/v/0_20_0'], (function (_0_20_0$2, _0_20_0, _0_20_0$1) { 'use strict';
1
+ LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_1', ['lwr/loader/v/0_20_1', 'lwr/preInit/v/0_20_1', 'lwr/init/v/0_20_1'], (function (_0_20_1$2, _0_20_1, _0_20_1$1) { 'use strict';
2
2
 
3
- const clientBootstrapConfig = _0_20_0.getClientBootstrapConfig();
3
+ const clientBootstrapConfig = _0_20_1.getClientBootstrapConfig();
4
4
  const { serverData, rootComponents } = clientBootstrapConfig;
5
5
 
6
6
  // initialize additional non-configured root components
7
7
  Promise.all(rootComponents.map(async (rootSpecifier) => {
8
- const element = _0_20_0$1.toKebabCase(rootSpecifier);
9
- const { default: Ctor } = await _0_20_0$2.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_0');
8
+ const element = _0_20_1$1.toKebabCase(rootSpecifier);
9
+ const { default: Ctor } = await _0_20_1$2.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_1');
10
10
  return [element, Ctor];
11
11
  })).then((rootModules) => {
12
- return _0_20_0$1.init(rootModules, serverData);
12
+ return _0_20_1$1.init(rootModules, serverData);
13
13
  }).then(() => {
14
14
  globalThis?.lwcRuntimeFlags?.ENABLE_WIRE_SYNC_EMIT &&
15
15
  (globalThis.lwcRuntimeFlags = {
@@ -1,10 +1,10 @@
1
- LWR.define('lwr/everywhereAmd/v/0_20_0', ['exports', 'lwr/vault/v/0_20_0'], (function (exports, _0_20_0) { 'use strict';
1
+ LWR.define('lwr/everywhereAmd/v/0_20_1', ['exports', 'lwr/vault/v/0_20_1'], (function (exports, _0_20_1) { '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 = _0_20_0.getAuthInfo();
7
+ const authInfo = _0_20_1.getAuthInfo();
8
8
  if (authInfo) {
9
9
  return fetch(url, {
10
10
  headers: {
@@ -53,7 +53,7 @@ LWR.define('lwr/everywhereAmd/v/0_20_0', ['exports', 'lwr/vault/v/0_20_0'], (fun
53
53
  function authenticate(authInfo) {
54
54
  // Put OAuth info into the vault
55
55
  if (authInfo) {
56
- _0_20_0.setAuthInfo(authInfo);
56
+ _0_20_1.setAuthInfo(authInfo);
57
57
  }
58
58
  }
59
59
 
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profiler/v/0_20_0', 'lwc/v/8_20_1'], (function (exports, _0_20_0$1, _0_20_0, _8_20_1) { 'use strict';
1
+ LWR.define('lwr/init/v/0_20_1', ['exports', 'lwr/metrics/v/0_20_1', 'lwr/profiler/v/0_20_1', 'lwc/v/8_20_1'], (function (exports, _0_20_1$1, _0_20_1, _8_20_1) { 'use strict';
2
2
 
3
3
  // eslint-disable-next-line lwr/only-allowed-type-imports
4
4
 
@@ -76,13 +76,13 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
76
76
  function init(rootModules, serverData = {}) {
77
77
  // eslint-disable-next-line lwr/no-unguarded-apis
78
78
  if (typeof globalThis.customElements === 'undefined' || typeof globalThis.document === 'undefined') {
79
- _0_20_0.logOperationStart({
80
- id: _0_20_0$1.BOOTSTRAP_END
79
+ _0_20_1.logOperationStart({
80
+ id: _0_20_1$1.BOOTSTRAP_END
81
81
  });
82
82
  return;
83
83
  }
84
- _0_20_0.logOperationStart({
85
- id: _0_20_0$1.INIT
84
+ _0_20_1.logOperationStart({
85
+ id: _0_20_1$1.INIT
86
86
  });
87
87
  (async () => {
88
88
  let index = 0;
@@ -100,8 +100,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
100
100
  // initialize and inject the root module into the LWR Root or DOM if it is missing
101
101
  // eslint-disable-next-line lwr/no-unguarded-apis
102
102
  if (!document.body.querySelector(elementName)) {
103
- _0_20_0.logOperationStart({
104
- id: _0_20_0$1.INIT_MODULE,
103
+ _0_20_1.logOperationStart({
104
+ id: _0_20_1$1.INIT_MODULE,
105
105
  specifier,
106
106
  specifierIndex
107
107
  });
@@ -112,8 +112,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
112
112
  const container = document.querySelector('[lwr-root]');
113
113
  // eslint-disable-next-line lwr/no-unguarded-apis
114
114
  container ? container.appendChild(component) : document.body.appendChild(component);
115
- _0_20_0.logOperationEnd({
116
- id: _0_20_0$1.INIT_MODULE,
115
+ _0_20_1.logOperationEnd({
116
+ id: _0_20_1$1.INIT_MODULE,
117
117
  specifier,
118
118
  specifierIndex,
119
119
  metadata: {
@@ -127,8 +127,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
127
127
  // eslint-disable-next-line lwr/no-unguarded-apis
128
128
  const elements = document.querySelectorAll(elementName);
129
129
  for (const element of elements) {
130
- _0_20_0.logOperationStart({
131
- id: _0_20_0$1.INIT_MODULE,
130
+ _0_20_1.logOperationStart({
131
+ id: _0_20_1$1.INIT_MODULE,
132
132
  specifier,
133
133
  specifierIndex
134
134
  });
@@ -137,8 +137,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
137
137
  // hydrate SSR'd components
138
138
  if (propsId) {
139
139
  hydrateComponentProxy(element, ctor, serverData[propsId] || {});
140
- _0_20_0.logOperationEnd({
141
- id: _0_20_0$1.INIT_MODULE,
140
+ _0_20_1.logOperationEnd({
141
+ id: _0_20_1$1.INIT_MODULE,
142
142
  specifier,
143
143
  specifierIndex,
144
144
  metadata: {
@@ -176,8 +176,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
176
176
  if (parent) {
177
177
  parent.replaceChild(component, element);
178
178
  }
179
- _0_20_0.logOperationEnd({
180
- id: _0_20_0$1.INIT_MODULE,
179
+ _0_20_1.logOperationEnd({
180
+ id: _0_20_1$1.INIT_MODULE,
181
181
  specifier,
182
182
  specifierIndex,
183
183
  metadata: {
@@ -187,11 +187,11 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
187
187
  }
188
188
  }
189
189
  })();
190
- _0_20_0.logOperationEnd({
191
- id: _0_20_0$1.INIT
190
+ _0_20_1.logOperationEnd({
191
+ id: _0_20_1$1.INIT
192
192
  });
193
- _0_20_0.logOperationStart({
194
- id: _0_20_0$1.BOOTSTRAP_END
193
+ _0_20_1.logOperationStart({
194
+ id: _0_20_1$1.BOOTSTRAP_END
195
195
  });
196
196
  }
197
197
 
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/loader/v/0_20_1', ['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_20_0', ['exports'], (function (exports) { 'use strict
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.20.0 */
9
+ /* LWR Module Loader v0.20.1 */
10
10
  const templateRegex = /\{([0-9]+)\}/g;
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  function templateString(template, args) {
@@ -338,6 +338,27 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
338
338
  // Loader: mappings
339
339
  const MAPPINGS_FETCH = `${LOADER_PREFIX}mappings.fetch`;
340
340
  const MAPPINGS_ERROR = `${LOADER_PREFIX}mappings.error`;
341
+ function _optionalChain(ops) {
342
+ let lastAccessLHS = undefined;
343
+ let value = ops[0];
344
+ let i = 1;
345
+ while (i < ops.length) {
346
+ const op = ops[i];
347
+ const fn = ops[i + 1];
348
+ i += 2;
349
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
350
+ return undefined;
351
+ }
352
+ if (op === 'access' || op === 'optionalAccess') {
353
+ lastAccessLHS = value;
354
+ value = fn(value);
355
+ } else if (op === 'call' || op === 'optionalCall') {
356
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
357
+ lastAccessLHS = undefined;
358
+ }
359
+ }
360
+ return value;
361
+ }
341
362
 
342
363
  /* spec based import map resolver */
343
364
  class ImportMetadataResolver {
@@ -351,10 +372,19 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
351
372
  __init3() {
352
373
  this.loadMappingHooks = [];
353
374
  }
375
+
376
+ // mapping request batching
377
+ __init4() {
378
+ this.batchSpecifiers = [];
379
+ }
380
+
381
+ // eslint-disable-next-line lwr/no-unguarded-apis
382
+
354
383
  constructor(config, invalidationCallback) {
355
384
  ImportMetadataResolver.prototype.__init.call(this);
356
385
  ImportMetadataResolver.prototype.__init2.call(this);
357
386
  ImportMetadataResolver.prototype.__init3.call(this);
387
+ ImportMetadataResolver.prototype.__init4.call(this);
358
388
  this.config = config;
359
389
  this.invalidationCallback = invalidationCallback;
360
390
  }
@@ -508,6 +538,27 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
508
538
  return this.fetchNewMappings(specifier);
509
539
  }
510
540
  async fetchNewMappings(specifier) {
541
+ if (!hasSetTimeout || !_optionalChain([this, 'access', _ => _.config, 'optionalAccess', _2 => _2.flags, 'optionalAccess', _3 => _3.batchMappings])) {
542
+ return this.fetchNewMappingsInner(specifier);
543
+ }
544
+ const batch = () => {
545
+ const specifiers = this.batchSpecifiers.join(',');
546
+ this.batchSpecifiers = []; // clear pending mapping requests
547
+ // eslint-disable-next-line lwr/no-unguarded-apis
548
+ clearTimeout(this.batchTimer); // cancel the batch timer
549
+ this.batchTimer = undefined;
550
+ return this.fetchNewMappingsInner(specifiers);
551
+ };
552
+ if (!this.batchPromise || this.batchSpecifiers.length === 0) {
553
+ this.batchPromise = new Promise(resolve => {
554
+ // eslint-disable-next-line lwr/no-unguarded-apis
555
+ this.batchTimer = setTimeout(() => resolve(batch()), 0);
556
+ });
557
+ }
558
+ this.batchSpecifiers.push(specifier);
559
+ return this.batchPromise;
560
+ }
561
+ async fetchNewMappingsInner(specifier) {
511
562
  if (typeof globalThis.fetch !== 'function') {
512
563
  throw new LoaderError(UNRESOLVED, [specifier]);
513
564
  }
@@ -1464,7 +1515,8 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
1464
1515
  this.registry = new ModuleRegistry(Object.freeze({
1465
1516
  endpoints: config.endpoints,
1466
1517
  baseUrl,
1467
- profiler
1518
+ profiler,
1519
+ flags: config.flags || {}
1468
1520
  }));
1469
1521
 
1470
1522
  // TODO: W-10539691 - temp workaround for LWR-Java -- remove once appId is implemented there
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/metrics/v/0_20_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/metrics/v/0_20_1', ['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  // Bootstrap / shim
4
4
  const BOOTSTRAP_PREFIX = 'lwr.bootstrap.';
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/preInit/v/0_20_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/preInit/v/0_20_1', ['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_20_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/profiler/v/0_20_1', ['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_20_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/vault/v/0_20_1', ['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
@@ -4,5 +4,5 @@
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.20.0 */
7
+ /* LWR Error Shim v0.20.1 */
8
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.20.0 */
7
+ /* LWR Module Loader Shim v0.20.1 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -213,7 +213,7 @@
213
213
  // Parse configuration
214
214
  this.global = global;
215
215
  this.config = global.LWR ;
216
- this.loaderSpecifier = 'lwr/loader/v/0_20_0';
216
+ this.loaderSpecifier = 'lwr/loader/v/0_20_1';
217
217
 
218
218
  // Set up error handler
219
219
  this.errorHandler = this.config.onError ;
@@ -295,6 +295,7 @@
295
295
  const loaderConfig = {
296
296
  endpoints: this.config.endpoints,
297
297
  baseUrl: this.config.baseUrl,
298
+ flags: this.config.flags,
298
299
  profiler: { logOperationStart, logOperationEnd },
299
300
  // TODO: can be removed following https://github.com/salesforce-experience-platform-emu/lwr/issues/1087
300
301
  appMetadata: {
@@ -364,7 +365,7 @@
364
365
  const exporter = (exports) => {
365
366
  Object.assign(exports, { logOperationStart, logOperationEnd });
366
367
  };
367
- define('lwr/profiler/v/0_20_0', ['exports'], exporter);
368
+ define('lwr/profiler/v/0_20_1', ['exports'], exporter);
368
369
  }
369
370
 
370
371
  // Set up the application globals, import map, root custom element...
@@ -456,14 +457,14 @@
456
457
  // The loader module is ALWAYS required
457
458
  const GLOBAL = globalThis ;
458
459
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
459
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_20_0') < 0) {
460
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_20_0');
460
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_20_1') < 0) {
461
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_20_1');
461
462
  }
462
463
  new LoaderShim(GLOBAL);
463
464
 
464
465
  })();
465
466
 
466
- LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict';
467
+ LWR.define('lwr/loader/v/0_20_1', ['exports'], (function (exports) { 'use strict';
467
468
 
468
469
  const templateRegex = /\{([0-9]+)\}/g;
469
470
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -826,6 +827,16 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
826
827
  const MAPPINGS_FETCH = `${LOADER_PREFIX}mappings.fetch`;
827
828
  const MAPPINGS_ERROR = `${LOADER_PREFIX}mappings.error`;
828
829
 
830
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
831
+
832
+
833
+
834
+
835
+
836
+
837
+
838
+
839
+
829
840
  /* spec based import map resolver */
830
841
  class ImportMetadataResolver {
831
842
  // Default to empty mappings
@@ -835,7 +846,13 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
835
846
 
836
847
  __init3() {this.loadMappingHooks = [];}
837
848
 
838
- constructor(config, invalidationCallback) {ImportMetadataResolver.prototype.__init.call(this);ImportMetadataResolver.prototype.__init2.call(this);ImportMetadataResolver.prototype.__init3.call(this);
849
+ // mapping request batching
850
+ __init4() {this.batchSpecifiers = [];}
851
+
852
+ // eslint-disable-next-line lwr/no-unguarded-apis
853
+
854
+
855
+ constructor(config, invalidationCallback) {ImportMetadataResolver.prototype.__init.call(this);ImportMetadataResolver.prototype.__init2.call(this);ImportMetadataResolver.prototype.__init3.call(this);ImportMetadataResolver.prototype.__init4.call(this);
839
856
  this.config = config;
840
857
  this.invalidationCallback = invalidationCallback;
841
858
  }
@@ -1008,6 +1025,30 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
1008
1025
  }
1009
1026
 
1010
1027
  async fetchNewMappings(specifier) {
1028
+ if (!hasSetTimeout || !_optionalChain([this, 'access', _ => _.config, 'optionalAccess', _2 => _2.flags, 'optionalAccess', _3 => _3.batchMappings])) {
1029
+ return this.fetchNewMappingsInner(specifier);
1030
+ }
1031
+
1032
+ const batch = () => {
1033
+ const specifiers = this.batchSpecifiers.join(',');
1034
+ this.batchSpecifiers = []; // clear pending mapping requests
1035
+ // eslint-disable-next-line lwr/no-unguarded-apis
1036
+ clearTimeout(this.batchTimer); // cancel the batch timer
1037
+ this.batchTimer = undefined;
1038
+ return this.fetchNewMappingsInner(specifiers);
1039
+ };
1040
+
1041
+ if (!this.batchPromise || this.batchSpecifiers.length === 0) {
1042
+ this.batchPromise = new Promise((resolve) => {
1043
+ // eslint-disable-next-line lwr/no-unguarded-apis
1044
+ this.batchTimer = setTimeout(() => resolve(batch()), 0);
1045
+ });
1046
+ }
1047
+ this.batchSpecifiers.push(specifier);
1048
+ return this.batchPromise;
1049
+ }
1050
+
1051
+ async fetchNewMappingsInner(specifier) {
1011
1052
  if (typeof globalThis.fetch !== 'function') {
1012
1053
  throw new LoaderError(UNRESOLVED, [specifier]);
1013
1054
  }
@@ -2070,7 +2111,14 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
2070
2111
  };
2071
2112
  }
2072
2113
 
2073
- this.registry = new ModuleRegistry(Object.freeze({ endpoints: config.endpoints, baseUrl, profiler }));
2114
+ this.registry = new ModuleRegistry(
2115
+ Object.freeze({
2116
+ endpoints: config.endpoints,
2117
+ baseUrl,
2118
+ profiler,
2119
+ flags: config.flags || {},
2120
+ }),
2121
+ );
2074
2122
 
2075
2123
  // TODO: W-10539691 - temp workaround for LWR-Java -- remove once appId is implemented there
2076
2124
  if (config.appMetadata && !config.appMetadata.appId) {
@@ -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_20_0`;
23
+ const BOOT_MODULE = `lwr/everywhere${format === 'esm' ? 'Esm' : 'Amd'}/v/0_20_1`;
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.20.0 */
55
+ /* LWR Module Loader v0.20.1 */
56
56
  const templateRegex = /\{([0-9]+)\}/g;
57
57
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
58
  function templateString(template, args) {
@@ -414,6 +414,16 @@ const MODULE_ERROR = `${LOADER_PREFIX}module.error`;
414
414
  const MAPPINGS_FETCH = `${LOADER_PREFIX}mappings.fetch`;
415
415
  const MAPPINGS_ERROR = `${LOADER_PREFIX}mappings.error`;
416
416
 
417
+ function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
417
427
  /* spec based import map resolver */
418
428
  class ImportMetadataResolver {
419
429
  // Default to empty mappings
@@ -423,7 +433,13 @@ class ImportMetadataResolver {
423
433
 
424
434
  __init3() {this.loadMappingHooks = [];}
425
435
 
426
- constructor(config, invalidationCallback) {ImportMetadataResolver.prototype.__init.call(this);ImportMetadataResolver.prototype.__init2.call(this);ImportMetadataResolver.prototype.__init3.call(this);
436
+ // mapping request batching
437
+ __init4() {this.batchSpecifiers = [];}
438
+
439
+ // eslint-disable-next-line lwr/no-unguarded-apis
440
+
441
+
442
+ constructor(config, invalidationCallback) {ImportMetadataResolver.prototype.__init.call(this);ImportMetadataResolver.prototype.__init2.call(this);ImportMetadataResolver.prototype.__init3.call(this);ImportMetadataResolver.prototype.__init4.call(this);
427
443
  this.config = config;
428
444
  this.invalidationCallback = invalidationCallback;
429
445
  }
@@ -596,6 +612,30 @@ class ImportMetadataResolver {
596
612
  }
597
613
 
598
614
  async fetchNewMappings(specifier) {
615
+ if (!hasSetTimeout || !_optionalChain$1([this, 'access', _ => _.config, 'optionalAccess', _2 => _2.flags, 'optionalAccess', _3 => _3.batchMappings])) {
616
+ return this.fetchNewMappingsInner(specifier);
617
+ }
618
+
619
+ const batch = () => {
620
+ const specifiers = this.batchSpecifiers.join(',');
621
+ this.batchSpecifiers = []; // clear pending mapping requests
622
+ // eslint-disable-next-line lwr/no-unguarded-apis
623
+ clearTimeout(this.batchTimer); // cancel the batch timer
624
+ this.batchTimer = undefined;
625
+ return this.fetchNewMappingsInner(specifiers);
626
+ };
627
+
628
+ if (!this.batchPromise || this.batchSpecifiers.length === 0) {
629
+ this.batchPromise = new Promise((resolve) => {
630
+ // eslint-disable-next-line lwr/no-unguarded-apis
631
+ this.batchTimer = setTimeout(() => resolve(batch()), 0);
632
+ });
633
+ }
634
+ this.batchSpecifiers.push(specifier);
635
+ return this.batchPromise;
636
+ }
637
+
638
+ async fetchNewMappingsInner(specifier) {
599
639
  if (typeof globalThis.fetch !== 'function') {
600
640
  throw new LoaderError(UNRESOLVED, [specifier]);
601
641
  }
@@ -1659,7 +1699,14 @@ class Loader {
1659
1699
  };
1660
1700
  }
1661
1701
 
1662
- this.registry = new ModuleRegistry(Object.freeze({ endpoints: config.endpoints, baseUrl, profiler }));
1702
+ this.registry = new ModuleRegistry(
1703
+ Object.freeze({
1704
+ endpoints: config.endpoints,
1705
+ baseUrl,
1706
+ profiler,
1707
+ flags: config.flags || {},
1708
+ }),
1709
+ );
1663
1710
 
1664
1711
  // TODO: W-10539691 - temp workaround for LWR-Java -- remove once appId is implemented there
1665
1712
  if (config.appMetadata && !config.appMetadata.appId) {
@@ -1782,7 +1829,7 @@ const { bootstrapModule, endpoints, baseUrl, imports, index } = configuration;
1782
1829
 
1783
1830
  // Initialize the AMD loader (its code is bundled into the LWR Everywhere module)
1784
1831
  const loader = new Loader({ endpoints, baseUrl });
1785
- loader.define('lwr/loader/v/0_20_0', ['exports'], (exports) => {
1832
+ loader.define('lwr/loader/v/0_20_1', ['exports'], (exports) => {
1786
1833
  Object.assign(exports, {
1787
1834
  define: loader.define.bind(loader),
1788
1835
  load: loader.load.bind(loader),
@@ -1792,12 +1839,12 @@ await loader.registerImportMappings({ imports, index }, [bootstrapModule]);
1792
1839
  (globalThis ).LWR = Object.freeze({ define: loader.define.bind(loader) });
1793
1840
 
1794
1841
  // Define preload modules (ie: ABS, vault, etc) BEFORE loading them
1795
- LWR.define('lwr/everywhereAmd/v/0_20_0', ['exports', 'lwr/vault/v/0_20_0'], (function (exports, _0_20_0) {
1842
+ LWR.define('lwr/everywhereAmd/v/0_20_1', ['exports', 'lwr/vault/v/0_20_1'], (function (exports, _0_20_1) {
1796
1843
  // IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
1797
1844
 
1798
1845
  // Do an OAuthed fetch
1799
1846
  async function authFetch(url, accept = 'javascript') {
1800
- const authInfo = _0_20_0.getAuthInfo();
1847
+ const authInfo = _0_20_1.getAuthInfo();
1801
1848
  if (authInfo) {
1802
1849
  return fetch(url, {
1803
1850
  headers: {
@@ -1846,7 +1893,7 @@ LWR.define('lwr/everywhereAmd/v/0_20_0', ['exports', 'lwr/vault/v/0_20_0'], (fun
1846
1893
  function authenticate(authInfo) {
1847
1894
  // Put OAuth info into the vault
1848
1895
  if (authInfo) {
1849
- _0_20_0.setAuthInfo(authInfo);
1896
+ _0_20_1.setAuthInfo(authInfo);
1850
1897
  }
1851
1898
  }
1852
1899
 
@@ -1856,7 +1903,7 @@ LWR.define('lwr/everywhereAmd/v/0_20_0', ['exports', 'lwr/vault/v/0_20_0'], (fun
1856
1903
  Object.defineProperty(exports, '__esModule', { value: true });
1857
1904
 
1858
1905
  }));
1859
- LWR.define('lwr/vault/v/0_20_0', ['exports'], (function (exports) {
1906
+ LWR.define('lwr/vault/v/0_20_1', ['exports'], (function (exports) {
1860
1907
  // Credential vault for storing setters and subscribers for OAuth info
1861
1908
  // This module is a SINGLETON and must be excluded from ESM bundling
1862
1909
 
@@ -1880,7 +1927,7 @@ LWR.define('lwr/vault/v/0_20_0', ['exports'], (function (exports) {
1880
1927
 
1881
1928
  // Set up the AMD loader hooks for OAuth
1882
1929
  const { initAmd, authenticate } = await loader.load(bootstrapModule);
1883
- initAmd(loader.services, _optionalChain([endpoints, 'optionalAccess', _ => _.uris, 'access', _2 => _2.mapping]), '0_20_0');
1930
+ initAmd(loader.services, _optionalChain([endpoints, 'optionalAccess', _ => _.uris, 'access', _2 => _2.mapping]), '0_20_1');
1884
1931
 
1885
1932
  // Wrap the createComponent API to allow proper ordering of module definitions:
1886
1933
  // 1. LWRE module bundle (this): lwr/loader, lwr/everywhereAmd, lwr/vault