@lwrjs/everywhere 0.19.2 → 0.19.3

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/02ae7930358df627b93ecbd3eb99f9df/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_19_2 → 0_19_3}/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_19_2 → 0_19_3}/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_19_2 → 0_19_3}/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_19_2/s/486cfdfb5e8f204e591c8b3c4510c370 → 0_19_3/s/ba599b27c9302da4641024ef27bbad90}/lwr_loader.js +73 -29
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_19_2 → 0_19_3}/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_19_2 → 0_19_3}/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_19_2 → 0_19_3}/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_19_2 → 0_19_3}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_19_2 → 0_19_3}/lwr-error-shim.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_19_2 → 0_19_3}/lwr-loader-shim.bundle.js +75 -39
  12. package/build/assets/amd/lwr-everywhere-debug.js +77 -41
  13. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  14. package/build/assets/amd/lwr-everywhere.js +77 -41
  15. package/build/assets/core/lwr-everywhere-debug.js +73 -37
  16. package/build/assets/core/lwr-everywhere-min.js +2 -2
  17. package/build/assets/core/lwr-everywhere.js +73 -37
  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/9a344f14124d83f47dc344d08a68b823/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_19_3","autoBoot":true,"imports":{"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_19_3/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_19_3"],"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_19_3/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js":["lwr/preInit/v/0_19_3"],"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_19_3/s/ba081ae41570981325062377381a1ea2/lwr_init.js":["lwr/init/v/0_19_3"],"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_19_3/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js":["lwr/metrics/v/0_19_3"],"/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_19_3/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js":["lwr/everywhereAmd/v/0_19_3"],"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_19_3/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js":["lwr/vault/v/0_19_3"]},"index":{"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_19_3":"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_19_3/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js","lwr/preInit/v/0_19_3":"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_19_3/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js","lwr/init/v/0_19_3":"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_19_3/s/ba081ae41570981325062377381a1ea2/lwr_init.js","lwr/metrics/v/0_19_3":"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_19_3/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_19_3":"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_19_3/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js","lwr/vault/v/0_19_3":"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_19_3/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js"},"rootComponents":["lwr/everywhereAmd/v/0_19_3"],"serverData":{},"requiredModules":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_19_3"],"preloadModules":["lwr/preInit/v/0_19_3","lwr/init/v/0_19_3","lwr/metrics/v/0_19_3","lwc/v/8_20_1","lwr/everywhereAmd/v/0_19_3"],"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_19_3/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js":["lwr/profiler/v/0_19_3"],"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_19_3/s/ba599b27c9302da4641024ef27bbad90/lwr_loader.js":["lwr/loader/v/0_19_3"]})
11
+ if (!globalThis.LWR.index) { globalThis.LWR.index = {}; }
12
+ Object.assign(globalThis.LWR.index, {"lwr/profiler/v/0_19_3":"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_19_3/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js","lwr/loader/v/0_19_3":"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_19_3/s/ba599b27c9302da4641024ef27bbad90/lwr_loader.js"})
@@ -1,15 +1,15 @@
1
- LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_19_2', ['lwr/loader/v/0_19_2', 'lwr/preInit/v/0_19_2', 'lwr/init/v/0_19_2'], (function (_0_19_2$2, _0_19_2, _0_19_2$1) { 'use strict';
1
+ LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_19_3', ['lwr/loader/v/0_19_3', 'lwr/preInit/v/0_19_3', 'lwr/init/v/0_19_3'], (function (_0_19_3$2, _0_19_3, _0_19_3$1) { 'use strict';
2
2
 
3
- const clientBootstrapConfig = _0_19_2.getClientBootstrapConfig();
3
+ const clientBootstrapConfig = _0_19_3.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_19_2$1.toKebabCase(rootSpecifier);
9
- const { default: Ctor } = await _0_19_2$2.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_19_2');
8
+ const element = _0_19_3$1.toKebabCase(rootSpecifier);
9
+ const { default: Ctor } = await _0_19_3$2.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_19_3');
10
10
  return [element, Ctor];
11
11
  })).then((rootModules) => {
12
- return _0_19_2$1.init(rootModules, serverData);
12
+ return _0_19_3$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_19_2', ['exports', 'lwr/vault/v/0_19_2'], (function (exports, _0_19_2) { 'use strict';
1
+ LWR.define('lwr/everywhereAmd/v/0_19_3', ['exports', 'lwr/vault/v/0_19_3'], (function (exports, _0_19_3) { '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_19_2.getAuthInfo();
7
+ const authInfo = _0_19_3.getAuthInfo();
8
8
  if (authInfo) {
9
9
  return fetch(url, {
10
10
  headers: {
@@ -53,7 +53,7 @@ LWR.define('lwr/everywhereAmd/v/0_19_2', ['exports', 'lwr/vault/v/0_19_2'], (fun
53
53
  function authenticate(authInfo) {
54
54
  // Put OAuth info into the vault
55
55
  if (authInfo) {
56
- _0_19_2.setAuthInfo(authInfo);
56
+ _0_19_3.setAuthInfo(authInfo);
57
57
  }
58
58
  }
59
59
 
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/init/v/0_19_2', ['exports', 'lwr/metrics/v/0_19_2', 'lwr/profiler/v/0_19_2', 'lwc/v/8_20_1'], (function (exports, _0_19_2$1, _0_19_2, _8_20_1) { 'use strict';
1
+ LWR.define('lwr/init/v/0_19_3', ['exports', 'lwr/metrics/v/0_19_3', 'lwr/profiler/v/0_19_3', 'lwc/v/8_20_1'], (function (exports, _0_19_3$1, _0_19_3, _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_19_2', ['exports', 'lwr/metrics/v/0_19_2', '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_19_2.logOperationStart({
80
- id: _0_19_2$1.BOOTSTRAP_END
79
+ _0_19_3.logOperationStart({
80
+ id: _0_19_3$1.BOOTSTRAP_END
81
81
  });
82
82
  return;
83
83
  }
84
- _0_19_2.logOperationStart({
85
- id: _0_19_2$1.INIT
84
+ _0_19_3.logOperationStart({
85
+ id: _0_19_3$1.INIT
86
86
  });
87
87
  (async () => {
88
88
  let index = 0;
@@ -100,8 +100,8 @@ LWR.define('lwr/init/v/0_19_2', ['exports', 'lwr/metrics/v/0_19_2', '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_19_2.logOperationStart({
104
- id: _0_19_2$1.INIT_MODULE,
103
+ _0_19_3.logOperationStart({
104
+ id: _0_19_3$1.INIT_MODULE,
105
105
  specifier,
106
106
  specifierIndex
107
107
  });
@@ -112,8 +112,8 @@ LWR.define('lwr/init/v/0_19_2', ['exports', 'lwr/metrics/v/0_19_2', '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_19_2.logOperationEnd({
116
- id: _0_19_2$1.INIT_MODULE,
115
+ _0_19_3.logOperationEnd({
116
+ id: _0_19_3$1.INIT_MODULE,
117
117
  specifier,
118
118
  specifierIndex,
119
119
  metadata: {
@@ -127,8 +127,8 @@ LWR.define('lwr/init/v/0_19_2', ['exports', 'lwr/metrics/v/0_19_2', '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_19_2.logOperationStart({
131
- id: _0_19_2$1.INIT_MODULE,
130
+ _0_19_3.logOperationStart({
131
+ id: _0_19_3$1.INIT_MODULE,
132
132
  specifier,
133
133
  specifierIndex
134
134
  });
@@ -137,8 +137,8 @@ LWR.define('lwr/init/v/0_19_2', ['exports', 'lwr/metrics/v/0_19_2', 'lwr/profile
137
137
  // hydrate SSR'd components
138
138
  if (propsId) {
139
139
  hydrateComponentProxy(element, ctor, serverData[propsId] || {});
140
- _0_19_2.logOperationEnd({
141
- id: _0_19_2$1.INIT_MODULE,
140
+ _0_19_3.logOperationEnd({
141
+ id: _0_19_3$1.INIT_MODULE,
142
142
  specifier,
143
143
  specifierIndex,
144
144
  metadata: {
@@ -176,8 +176,8 @@ LWR.define('lwr/init/v/0_19_2', ['exports', 'lwr/metrics/v/0_19_2', 'lwr/profile
176
176
  if (parent) {
177
177
  parent.replaceChild(component, element);
178
178
  }
179
- _0_19_2.logOperationEnd({
180
- id: _0_19_2$1.INIT_MODULE,
179
+ _0_19_3.logOperationEnd({
180
+ id: _0_19_3$1.INIT_MODULE,
181
181
  specifier,
182
182
  specifierIndex,
183
183
  metadata: {
@@ -187,11 +187,11 @@ LWR.define('lwr/init/v/0_19_2', ['exports', 'lwr/metrics/v/0_19_2', 'lwr/profile
187
187
  }
188
188
  }
189
189
  })();
190
- _0_19_2.logOperationEnd({
191
- id: _0_19_2$1.INIT
190
+ _0_19_3.logOperationEnd({
191
+ id: _0_19_3$1.INIT
192
192
  });
193
- _0_19_2.logOperationStart({
194
- id: _0_19_2$1.BOOTSTRAP_END
193
+ _0_19_3.logOperationStart({
194
+ id: _0_19_3$1.BOOTSTRAP_END
195
195
  });
196
196
  }
197
197
 
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/loader/v/0_19_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/loader/v/0_19_3', ['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_19_2', ['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.19.2 */
9
+ /* LWR Module Loader v0.19.3 */
10
10
  const templateRegex = /\{([0-9]+)\}/g;
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  function templateString(template, args) {
@@ -975,60 +975,104 @@ LWR.define('lwr/loader/v/0_19_2', ['exports'], (function (exports) { 'use strict
975
975
  return this.resolver;
976
976
  }
977
977
 
978
- // Returns an existing module record by the resolvedId or aliased id
979
- getExistingModuleRecord(resolvedId, aliasId) {
980
- const moduleRecord = this.moduleRegistry.get(resolvedId);
981
- if (moduleRecord) {
982
- this.storeModuleAlias(aliasId, resolvedId);
983
- return moduleRecord;
978
+ /**
979
+ * Gets or creates a module record for the given resolved ID and original ID.
980
+ *
981
+ * This function handles the complex logic of module resolution and ensures that:
982
+ * 1. Modules loaded via different paths (aliases, direct specifiers, URLs) return the same instance
983
+ * 2. Bundle URLs are properly resolved to their final specifier names after instantiation
984
+ * 3. Alias mappings are maintained for future lookups
985
+ *
986
+ * @param resolvedId - The resolved module identifier (could be a URL or specifier)
987
+ * @param originalId - The original module specifer that was requested
988
+ * @returns Promise<ModuleRecord> - The module record for the module
989
+ */
990
+ async getModuleRecord(resolvedId, originalId) {
991
+ // Step 1: Check if we already have a module record for the resolved ID
992
+ const existingRecord = this.moduleRegistry.get(resolvedId);
993
+ if (existingRecord) {
994
+ if (isUrl(resolvedId)) {
995
+ // Special case: The resolved ID is a URL (likely a bundle URL)
996
+ // We need to wait for instantiation to complete, then re-resolve to get the final specifier
997
+ const moduleDef = await existingRecord.instantiation;
998
+ const reResolvedId = await this.resolve(originalId);
999
+
1000
+ // If the re-resolved ID is still a URL OR matches the module definition name,
1001
+ // then this is an internally mapped module (e.g., bundle -> specifier)
1002
+ if (isUrl(reResolvedId) || moduleDef.name === reResolvedId) {
1003
+ // Store the alias mapping and return the existing record
1004
+ this.storeModuleAlias(originalId, reResolvedId);
1005
+ return existingRecord;
1006
+ } else {
1007
+ // The re-resolved ID is now a specifier, check if we have a record for it
1008
+ resolvedId = reResolvedId;
1009
+ const reExistingRecord = this.moduleRegistry.get(resolvedId);
1010
+ if (reExistingRecord) {
1011
+ // Found a record for the specifier, store alias and return it
1012
+ this.storeModuleAlias(originalId, reResolvedId);
1013
+ return reExistingRecord;
1014
+ }
1015
+ }
1016
+ } else if (existingRecord) {
1017
+ // Simple case: resolved ID is a specifier and we have a record for it
1018
+ this.storeModuleAlias(originalId, resolvedId);
1019
+ return existingRecord;
1020
+ }
984
1021
  }
985
1022
 
986
- // Check if this is a known alias
987
- if (resolvedId !== aliasId) {
988
- const alias = this.aliases.get(aliasId);
1023
+ // Step 2: Check if the original ID is a known alias that maps to an existing module
1024
+ if (resolvedId !== originalId) {
1025
+ const alias = this.aliases.get(originalId);
989
1026
  if (alias) {
990
1027
  const aliasedModule = this.moduleRegistry.get(alias);
991
1028
  if (aliasedModule) {
1029
+ // Found an existing module via alias, return it
992
1030
  return aliasedModule;
993
1031
  }
994
1032
  }
995
1033
  }
996
- return moduleRecord;
997
- }
998
- async getModuleRecord(resolvedId, id) {
999
- // Look for an existing record
1000
- const existingRecord = this.getExistingModuleRecord(resolvedId, id);
1001
- if (existingRecord) {
1002
- // return existing
1003
- return existingRecord;
1004
- }
1005
1034
 
1006
- // Create a new Module Record
1007
- const instantiation = this.getModuleDef(resolvedId, id);
1035
+ // Step 3: No existing record found, create a new module record
1036
+ const instantiation = this.getModuleDef(resolvedId, originalId);
1037
+
1038
+ // Create dependency records for all module dependencies
1008
1039
  const dependencyRecords = instantiation.then(moduleDef => {
1009
1040
  const dependencies = moduleDef.dependencies || [];
1010
- // get dep and filter out exports
1041
+
1042
+ // Map dependencies to module records, filtering out 'exports' and 'require'
1011
1043
  const filtered = dependencies.map(dep => {
1012
1044
  if (dep === 'exports') {
1013
- return;
1045
+ return; // 'exports' is a special AMD dependency, not a real module
1014
1046
  }
1015
- invariant(dep !== 'require', NO_AMD_REQUIRE);
1047
+ invariant(dep !== 'require', NO_AMD_REQUIRE); // 'require' is not allowed
1016
1048
  return this.getModuleDependencyRecord.call(this, dep);
1017
1049
  }).filter(depRecord => depRecord !== undefined);
1018
1050
  return Promise.all(filtered);
1019
1051
  });
1052
+
1053
+ // Create the new module record
1020
1054
  const newModuleRecord = {
1021
1055
  id: resolvedId,
1056
+ // Use resolved ID as the record identifier
1057
+ originalId: originalId,
1058
+ // Keep track of the original requested ID
1022
1059
  module: Object.create(null),
1060
+ // Empty object for module exports
1023
1061
  dependencyRecords,
1062
+ // Promise for dependency module records
1024
1063
  instantiation,
1064
+ // Promise for module definition
1025
1065
  evaluated: false,
1026
- evaluationPromise: null
1066
+ // Track if module has been evaluated
1067
+ evaluationPromise: null // Promise for module evaluation
1027
1068
  };
1028
- this.moduleRegistry.set(resolvedId, newModuleRecord);
1029
- this.storeModuleAlias(id, resolvedId);
1030
1069
 
1031
- // Wait for the dependencies to resolve the return the moduleRecord
1070
+ // Store the module record and create alias mapping
1071
+ this.moduleRegistry.set(resolvedId, newModuleRecord);
1072
+ if (resolvedId !== originalId) {
1073
+ this.storeModuleAlias(originalId, resolvedId);
1074
+ }
1075
+ // Wait for dependencies to resolve before returning the module record
1032
1076
  return dependencyRecords.then(() => newModuleRecord);
1033
1077
  }
1034
1078
  storeModuleAlias(aliasId, resolvedId) {
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/metrics/v/0_19_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/metrics/v/0_19_3', ['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_19_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/preInit/v/0_19_3', ['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_19_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/profiler/v/0_19_3', ['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_19_2', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/vault/v/0_19_3', ['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.19.2 */
7
+ /* LWR Error Shim v0.19.3 */
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.19.2 */
7
+ /* LWR Module Loader Shim v0.19.3 */
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_19_2';
216
+ this.loaderSpecifier = 'lwr/loader/v/0_19_3';
217
217
 
218
218
  // Set up error handler
219
219
  this.errorHandler = this.config.onError ;
@@ -364,7 +364,7 @@
364
364
  const exporter = (exports) => {
365
365
  Object.assign(exports, { logOperationStart, logOperationEnd });
366
366
  };
367
- define('lwr/profiler/v/0_19_2', ['exports'], exporter);
367
+ define('lwr/profiler/v/0_19_3', ['exports'], exporter);
368
368
  }
369
369
 
370
370
  // Set up the application globals, import map, root custom element...
@@ -456,14 +456,14 @@
456
456
  // The loader module is ALWAYS required
457
457
  const GLOBAL = globalThis ;
458
458
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
459
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_19_2') < 0) {
460
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_19_2');
459
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_19_3') < 0) {
460
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_19_3');
461
461
  }
462
462
  new LoaderShim(GLOBAL);
463
463
 
464
464
  })();
465
465
 
466
- LWR.define('lwr/loader/v/0_19_2', ['exports'], (function (exports) { 'use strict';
466
+ LWR.define('lwr/loader/v/0_19_3', ['exports'], (function (exports) { 'use strict';
467
467
 
468
468
  const templateRegex = /\{([0-9]+)\}/g;
469
469
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1310,6 +1310,7 @@ LWR.define('lwr/loader/v/0_19_2', ['exports'], (function (exports) { 'use strict
1310
1310
 
1311
1311
 
1312
1312
 
1313
+
1313
1314
 
1314
1315
 
1315
1316
  class ModuleRegistry {
@@ -1548,46 +1549,78 @@ LWR.define('lwr/loader/v/0_19_2', ['exports'], (function (exports) { 'use strict
1548
1549
  return this.resolver;
1549
1550
  }
1550
1551
 
1551
- // Returns an existing module record by the resolvedId or aliased id
1552
- getExistingModuleRecord(resolvedId, aliasId) {
1553
- const moduleRecord = this.moduleRegistry.get(resolvedId);
1554
- if (moduleRecord) {
1555
- this.storeModuleAlias(aliasId, resolvedId);
1556
- return moduleRecord;
1552
+ /**
1553
+ * Gets or creates a module record for the given resolved ID and original ID.
1554
+ *
1555
+ * This function handles the complex logic of module resolution and ensures that:
1556
+ * 1. Modules loaded via different paths (aliases, direct specifiers, URLs) return the same instance
1557
+ * 2. Bundle URLs are properly resolved to their final specifier names after instantiation
1558
+ * 3. Alias mappings are maintained for future lookups
1559
+ *
1560
+ * @param resolvedId - The resolved module identifier (could be a URL or specifier)
1561
+ * @param originalId - The original module specifer that was requested
1562
+ * @returns Promise<ModuleRecord> - The module record for the module
1563
+ */
1564
+ async getModuleRecord(resolvedId, originalId) {
1565
+ // Step 1: Check if we already have a module record for the resolved ID
1566
+ const existingRecord = this.moduleRegistry.get(resolvedId);
1567
+ if (existingRecord) {
1568
+ if (isUrl(resolvedId)) {
1569
+ // Special case: The resolved ID is a URL (likely a bundle URL)
1570
+ // We need to wait for instantiation to complete, then re-resolve to get the final specifier
1571
+ const moduleDef = await existingRecord.instantiation;
1572
+
1573
+ const reResolvedId = await this.resolve(originalId);
1574
+
1575
+ // If the re-resolved ID is still a URL OR matches the module definition name,
1576
+ // then this is an internally mapped module (e.g., bundle -> specifier)
1577
+ if (isUrl(reResolvedId) || moduleDef.name === reResolvedId) {
1578
+ // Store the alias mapping and return the existing record
1579
+ this.storeModuleAlias(originalId, reResolvedId);
1580
+ return existingRecord;
1581
+ } else {
1582
+ // The re-resolved ID is now a specifier, check if we have a record for it
1583
+ resolvedId = reResolvedId;
1584
+ const reExistingRecord = this.moduleRegistry.get(resolvedId);
1585
+ if (reExistingRecord) {
1586
+ // Found a record for the specifier, store alias and return it
1587
+ this.storeModuleAlias(originalId, reResolvedId);
1588
+ return reExistingRecord;
1589
+ }
1590
+ }
1591
+ } else if (existingRecord) {
1592
+ // Simple case: resolved ID is a specifier and we have a record for it
1593
+ this.storeModuleAlias(originalId, resolvedId);
1594
+ return existingRecord;
1595
+ }
1557
1596
  }
1558
1597
 
1559
- // Check if this is a known alias
1560
- if (resolvedId !== aliasId) {
1561
- const alias = this.aliases.get(aliasId);
1598
+ // Step 2: Check if the original ID is a known alias that maps to an existing module
1599
+ if (resolvedId !== originalId) {
1600
+ const alias = this.aliases.get(originalId);
1562
1601
  if (alias) {
1563
1602
  const aliasedModule = this.moduleRegistry.get(alias);
1564
1603
  if (aliasedModule) {
1604
+ // Found an existing module via alias, return it
1565
1605
  return aliasedModule;
1566
1606
  }
1567
1607
  }
1568
1608
  }
1569
- return moduleRecord;
1570
- }
1571
1609
 
1572
- async getModuleRecord(resolvedId, id) {
1573
- // Look for an existing record
1574
- const existingRecord = this.getExistingModuleRecord(resolvedId, id);
1575
- if (existingRecord) {
1576
- // return existing
1577
- return existingRecord;
1578
- }
1610
+ // Step 3: No existing record found, create a new module record
1611
+ const instantiation = this.getModuleDef(resolvedId, originalId);
1579
1612
 
1580
- // Create a new Module Record
1581
- const instantiation = this.getModuleDef(resolvedId, id);
1613
+ // Create dependency records for all module dependencies
1582
1614
  const dependencyRecords = instantiation.then((moduleDef) => {
1583
1615
  const dependencies = moduleDef.dependencies || [];
1584
- // get dep and filter out exports
1616
+
1617
+ // Map dependencies to module records, filtering out 'exports' and 'require'
1585
1618
  const filtered = dependencies
1586
1619
  .map((dep) => {
1587
1620
  if (dep === 'exports') {
1588
- return;
1621
+ return; // 'exports' is a special AMD dependency, not a real module
1589
1622
  }
1590
- invariant(dep !== 'require', NO_AMD_REQUIRE);
1623
+ invariant(dep !== 'require', NO_AMD_REQUIRE); // 'require' is not allowed
1591
1624
  return this.getModuleDependencyRecord.call(this, dep);
1592
1625
  })
1593
1626
  .filter((depRecord) => depRecord !== undefined) ;
@@ -1595,19 +1628,23 @@ LWR.define('lwr/loader/v/0_19_2', ['exports'], (function (exports) { 'use strict
1595
1628
  return Promise.all(filtered);
1596
1629
  });
1597
1630
 
1631
+ // Create the new module record
1598
1632
  const newModuleRecord = {
1599
- id: resolvedId,
1600
- module: Object.create(null),
1601
- dependencyRecords,
1602
- instantiation,
1603
- evaluated: false,
1604
- evaluationPromise: null,
1633
+ id: resolvedId, // Use resolved ID as the record identifier
1634
+ originalId: originalId, // Keep track of the original requested ID
1635
+ module: Object.create(null), // Empty object for module exports
1636
+ dependencyRecords, // Promise for dependency module records
1637
+ instantiation, // Promise for module definition
1638
+ evaluated: false, // Track if module has been evaluated
1639
+ evaluationPromise: null, // Promise for module evaluation
1605
1640
  };
1606
1641
 
1642
+ // Store the module record and create alias mapping
1607
1643
  this.moduleRegistry.set(resolvedId, newModuleRecord);
1608
- this.storeModuleAlias(id, resolvedId);
1609
-
1610
- // Wait for the dependencies to resolve the return the moduleRecord
1644
+ if (resolvedId !== originalId) {
1645
+ this.storeModuleAlias(originalId, resolvedId);
1646
+ }
1647
+ // Wait for dependencies to resolve before returning the module record
1611
1648
  return dependencyRecords.then(() => newModuleRecord);
1612
1649
  }
1613
1650
 
@@ -1903,7 +1940,6 @@ LWR.define('lwr/loader/v/0_19_2', ['exports'], (function (exports) { 'use strict
1903
1940
 
1904
1941
 
1905
1942
 
1906
-
1907
1943
  addLoaderPlugin(hooks) {
1908
1944
  if (typeof hooks !== 'object') {
1909
1945
  throw new LoaderError(INVALID_HOOK);