@lwrjs/everywhere 0.22.12 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/66cee26a86a5cee16ca4b90b9ade6846/config.js +12 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/{0_22_12 → 0_23_0}/s/d4022ae1b3a47f5bb62c600fd6b8f139/@lwrjs_app-service_amd-bootstrap_module_amd.js +5 -5
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{8_22_6/s/21cb42e66f1f2b4362fe6203653b692f → 9_1_2/s/0ab8cd8f94e09eb7da6a47fe0f3b6391}/lwc.js +173 -149
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_22_12 → 0_23_0}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_22_12 → 0_23_0}/s/c5c8bdc0e87baf3d6b68b0603d670664/lwr_init.js +22 -22
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_22_12/s/e5539130565e08d311bee05ff47797a5 → 0_23_0/s/b54ec6129b3ac74009e31768a140c50b}/lwr_loader.js +161 -10
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_22_12 → 0_23_0}/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_22_12 → 0_23_0}/s/9120455810adf1ca6b429479490a4b0d/lwr_preInit.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_22_12 → 0_23_0}/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/scheduler/v/{0_22_12 → 0_23_0}/s/fd3fe53248b540ca046ead92862ca496/lwr_scheduler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_22_12 → 0_23_0}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_22_12 → 0_23_0}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_22_12 → 0_23_0}/lwr-loader-shim.bundle.js +191 -19
- package/build/assets/amd/lwr-everywhere-debug.js +185 -15
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +185 -15
- package/build/assets/core/lwr-everywhere-debug.js +181 -11
- package/build/assets/core/lwr-everywhere-min.js +2 -2
- package/build/assets/core/lwr-everywhere.js +181 -11
- package/build/assets/esm/lwr-everywhere-debug.js +1 -1
- package/build/assets/esm/lwr-everywhere-min.js +1 -1
- package/build/assets/esm/lwr-everywhere.js +1 -1
- package/package.json +6 -6
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/ef04a79964a62c2d675f744778da4f9b/config.js +0 -12
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
LWR.define('lwr/everywhereAmd/v/
|
|
1
|
+
LWR.define('lwr/everywhereAmd/v/0_23_0', ['exports', 'lwr/vault/v/0_23_0'], (function (exports, _0_23_0) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
|
|
4
4
|
|
|
5
5
|
// Do an OAuthed fetch
|
|
6
6
|
async function authFetch(url, accept = 'javascript') {
|
|
7
|
-
const authInfo =
|
|
7
|
+
const authInfo = _0_23_0.getAuthInfo();
|
|
8
8
|
if (authInfo) {
|
|
9
9
|
return fetch(url, {
|
|
10
10
|
headers: {
|
|
@@ -53,7 +53,7 @@ LWR.define('lwr/everywhereAmd/v/0_22_12', ['exports', 'lwr/vault/v/0_22_12'], (f
|
|
|
53
53
|
function authenticate(authInfo) {
|
|
54
54
|
// Put OAuth info into the vault
|
|
55
55
|
if (authInfo) {
|
|
56
|
-
|
|
56
|
+
_0_23_0.setAuthInfo(authInfo);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/init/v/
|
|
1
|
+
LWR.define('lwr/init/v/0_23_0', ['exports', 'lwr/metrics/v/0_23_0', 'lwr/profiler/v/0_23_0', 'lwr/scheduler/v/0_23_0', 'lwc/v/9_1_2'], (function (exports, _0_23_0$1, _0_23_0, _0_23_0$2, _9_1_2) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line lwr/only-allowed-type-imports
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
7
7
|
const HYDRATE_DIRECTIVE = 'lwr:hydrate';
|
|
8
8
|
const HYDRATE_VISIBLE_VALUE = 'visible';
|
|
9
9
|
function hydrateComponentProxy(customElement, Ctor, props) {
|
|
10
|
-
|
|
10
|
+
_9_1_2.hydrateComponent(customElement, Ctor, props);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -85,7 +85,7 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
85
85
|
return visibilityObserver;
|
|
86
86
|
}
|
|
87
87
|
function initializeWebComponent(elementName, Ctor) {
|
|
88
|
-
return
|
|
88
|
+
return _9_1_2.createElement(elementName, {
|
|
89
89
|
is: Ctor
|
|
90
90
|
});
|
|
91
91
|
}
|
|
@@ -123,13 +123,13 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
123
123
|
function init(rootModules, serverData = {}) {
|
|
124
124
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
125
125
|
if (typeof globalThis.customElements === 'undefined' || typeof globalThis.document === 'undefined') {
|
|
126
|
-
|
|
127
|
-
id:
|
|
126
|
+
_0_23_0.logOperationStart({
|
|
127
|
+
id: _0_23_0$1.BOOTSTRAP_END
|
|
128
128
|
});
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
id:
|
|
131
|
+
_0_23_0.logOperationStart({
|
|
132
|
+
id: _0_23_0$1.INIT
|
|
133
133
|
});
|
|
134
134
|
(async () => {
|
|
135
135
|
let index = 0;
|
|
@@ -138,15 +138,15 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
138
138
|
for (const [specifier, ctor] of rootModules) {
|
|
139
139
|
// Yield to the main thread during long hydration tasks
|
|
140
140
|
// eslint-disable-next-line no-await-in-loop
|
|
141
|
-
await
|
|
141
|
+
await _0_23_0$2.yieldIfNecessary();
|
|
142
142
|
const specifierIndex = ++index;
|
|
143
143
|
const elementName = toKebabCase(specifier);
|
|
144
144
|
|
|
145
145
|
// initialize and inject the root module into the LWR Root or DOM if it is missing
|
|
146
146
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
147
147
|
if (!document.body.querySelector(elementName)) {
|
|
148
|
-
|
|
149
|
-
id:
|
|
148
|
+
_0_23_0.logOperationStart({
|
|
149
|
+
id: _0_23_0$1.INIT_MODULE,
|
|
150
150
|
specifier,
|
|
151
151
|
specifierIndex
|
|
152
152
|
});
|
|
@@ -157,8 +157,8 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
157
157
|
const container = document.querySelector('[lwr-root]');
|
|
158
158
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
159
159
|
container ? container.appendChild(component) : document.body.appendChild(component);
|
|
160
|
-
|
|
161
|
-
id:
|
|
160
|
+
_0_23_0.logOperationEnd({
|
|
161
|
+
id: _0_23_0$1.INIT_MODULE,
|
|
162
162
|
specifier,
|
|
163
163
|
specifierIndex,
|
|
164
164
|
metadata: {
|
|
@@ -172,8 +172,8 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
172
172
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
173
173
|
const elements = document.querySelectorAll(elementName);
|
|
174
174
|
for (const element of elements) {
|
|
175
|
-
|
|
176
|
-
id:
|
|
175
|
+
_0_23_0.logOperationStart({
|
|
176
|
+
id: _0_23_0$1.INIT_MODULE,
|
|
177
177
|
specifier,
|
|
178
178
|
specifierIndex
|
|
179
179
|
});
|
|
@@ -189,8 +189,8 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
189
189
|
// hydrate the island immediately
|
|
190
190
|
hydrateComponentProxy(element, ctor, serverData[propsId] || {});
|
|
191
191
|
}
|
|
192
|
-
|
|
193
|
-
id:
|
|
192
|
+
_0_23_0.logOperationEnd({
|
|
193
|
+
id: _0_23_0$1.INIT_MODULE,
|
|
194
194
|
specifier,
|
|
195
195
|
specifierIndex,
|
|
196
196
|
metadata: {
|
|
@@ -228,8 +228,8 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
228
228
|
if (parent) {
|
|
229
229
|
parent.replaceChild(component, element);
|
|
230
230
|
}
|
|
231
|
-
|
|
232
|
-
id:
|
|
231
|
+
_0_23_0.logOperationEnd({
|
|
232
|
+
id: _0_23_0$1.INIT_MODULE,
|
|
233
233
|
specifier,
|
|
234
234
|
specifierIndex,
|
|
235
235
|
metadata: {
|
|
@@ -239,11 +239,11 @@ LWR.define('lwr/init/v/0_22_12', ['exports', 'lwr/metrics/v/0_22_12', 'lwr/profi
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
})();
|
|
242
|
-
|
|
243
|
-
id:
|
|
242
|
+
_0_23_0.logOperationEnd({
|
|
243
|
+
id: _0_23_0$1.INIT
|
|
244
244
|
});
|
|
245
|
-
|
|
246
|
-
id:
|
|
245
|
+
_0_23_0.logOperationStart({
|
|
246
|
+
id: _0_23_0$1.BOOTSTRAP_END
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/loader/v/
|
|
1
|
+
LWR.define('lwr/loader/v/0_23_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) 2021, salesforce.com, inc.
|
|
@@ -6,7 +6,7 @@ LWR.define('lwr/loader/v/0_22_12', ['exports'], (function (exports) { 'use stric
|
|
|
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.
|
|
9
|
+
/* LWR Module Loader v0.23.0 */
|
|
10
10
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
12
|
function templateString(template, args) {
|
|
@@ -25,7 +25,7 @@ LWR.define('lwr/loader/v/0_22_12', ['exports'], (function (exports) { 'use stric
|
|
|
25
25
|
super();
|
|
26
26
|
this.message = generateErrorMessage(errorInfo, errorArgs);
|
|
27
27
|
}
|
|
28
|
-
/*LWC compiler
|
|
28
|
+
/*LWC compiler v9.1.2*/
|
|
29
29
|
}
|
|
30
30
|
function invariant(condition, errorInfo) {
|
|
31
31
|
if (!condition) {
|
|
@@ -418,17 +418,15 @@ LWR.define('lwr/loader/v/0_22_12', ['exports'], (function (exports) { 'use stric
|
|
|
418
418
|
getBaseUrl() {
|
|
419
419
|
return this.config.baseUrl || '';
|
|
420
420
|
}
|
|
421
|
-
registerImportMappings(newImportMetadata, rootSpecifiers) {
|
|
422
|
-
if (!rootSpecifiers || rootSpecifiers.length === 0) {
|
|
423
|
-
const imports = newImportMetadata ? JSON.stringify(newImportMetadata) : 'undefined';
|
|
424
|
-
throw new LoaderError(BAD_IMPORT_METADATA, [imports, rootSpecifiers ? '[]' : 'undefined']);
|
|
425
|
-
}
|
|
421
|
+
registerImportMappings(newImportMetadata, rootSpecifiers = []) {
|
|
426
422
|
if (!newImportMetadata) {
|
|
427
423
|
throw new LoaderError(BAD_IMPORT_METADATA, ['undefined', JSON.stringify(rootSpecifiers)]);
|
|
428
424
|
}
|
|
429
425
|
if (!newImportMetadata.imports || Object.keys(newImportMetadata.imports).length === 0) {
|
|
430
426
|
throw new LoaderError(BAD_IMPORT_METADATA, [JSON.stringify(newImportMetadata), JSON.stringify(rootSpecifiers)]);
|
|
431
427
|
}
|
|
428
|
+
// An empty rootSpecifiers list is valid for non-bootstrap registrations;
|
|
429
|
+
// any specifier not in the list receives isRoot: false.
|
|
432
430
|
const index = newImportMetadata.index || {};
|
|
433
431
|
for (const [uri, specifiers] of Object.entries(newImportMetadata.imports)) {
|
|
434
432
|
specifiers.forEach(specifier => {
|
|
@@ -451,6 +449,16 @@ LWR.define('lwr/loader/v/0_22_12', ['exports'], (function (exports) { 'use stric
|
|
|
451
449
|
}
|
|
452
450
|
}
|
|
453
451
|
|
|
452
|
+
/**
|
|
453
|
+
* Returns the raw URI stored for a specifier, or `undefined` if not yet mapped.
|
|
454
|
+
* Used by the runtime `importMap()` path to detect cross-call duplicates while
|
|
455
|
+
* allowing truly idempotent re-registrations (same specifier, same URI) to pass
|
|
456
|
+
* through silently.
|
|
457
|
+
*/
|
|
458
|
+
getMappingUri(specifier) {
|
|
459
|
+
return _optionalChain([this, 'access', _ => _.importURICache, 'access', _2 => _2.get, 'call', _3 => _3(specifier), 'optionalAccess', _4 => _4.uri]);
|
|
460
|
+
}
|
|
461
|
+
|
|
454
462
|
// Get URL from the local cache or return undefiend
|
|
455
463
|
getURI(specifier) {
|
|
456
464
|
return this.importURICache && this.importURICache.has(specifier) ? resolveUrl(this.importURICache.get(specifier).uri, this.getBaseUrl()) : undefined;
|
|
@@ -543,7 +551,7 @@ LWR.define('lwr/loader/v/0_22_12', ['exports'], (function (exports) { 'use stric
|
|
|
543
551
|
return this.fetchNewMappings(specifier);
|
|
544
552
|
}
|
|
545
553
|
async fetchNewMappings(specifier) {
|
|
546
|
-
if (!hasSetTimeout || !_optionalChain([this, 'access',
|
|
554
|
+
if (!hasSetTimeout || !_optionalChain([this, 'access', _5 => _5.config, 'optionalAccess', _6 => _6.flags, 'optionalAccess', _7 => _7.batchMappings])) {
|
|
547
555
|
return this.fetchNewMappingsInner(specifier);
|
|
548
556
|
}
|
|
549
557
|
const batch = () => {
|
|
@@ -1518,6 +1526,82 @@ LWR.define('lwr/loader/v/0_22_12', ['exports'], (function (exports) { 'use stric
|
|
|
1518
1526
|
}
|
|
1519
1527
|
}
|
|
1520
1528
|
|
|
1529
|
+
/**
|
|
1530
|
+
* Ensures the update object key is a safe, loader-supported script URL (not a bare specifier).
|
|
1531
|
+
* Covers dangerous schemes and URL-key shape in one place.
|
|
1532
|
+
*/
|
|
1533
|
+
function assertValidImportMapUrlKey(moduleScriptURL) {
|
|
1534
|
+
const lowerUri = moduleScriptURL.toLowerCase();
|
|
1535
|
+
if (lowerUri.startsWith('blob:')) {
|
|
1536
|
+
throw new Error(`Cannot map ${moduleScriptURL} to blob: URL`);
|
|
1537
|
+
}
|
|
1538
|
+
if (lowerUri.startsWith('data:')) {
|
|
1539
|
+
throw new Error(`Cannot map ${moduleScriptURL} to data: URL`);
|
|
1540
|
+
}
|
|
1541
|
+
if (!/^[./]|^https?:/.test(moduleScriptURL)) {
|
|
1542
|
+
throw new Error(`LWR.importMap(): "${moduleScriptURL}" is not a valid URL key. Keys must be URL paths (e.g. "/path/to/module.js"), not module specifiers. Transitive specifier aliasing is not supported by this loader.`);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* Validates an ImportMapUpdate and wraps it as ImportMetadata for the fingerprints loader.
|
|
1548
|
+
*
|
|
1549
|
+
* Does not apply legacy-style protected-specifier blocking; system modules are expected to be
|
|
1550
|
+
* defined at bootstrap, and `importMap` write-once semantics handle redundant runtime entries.
|
|
1551
|
+
*
|
|
1552
|
+
* Duplicate specifiers in the same update are de-duplicated silently (first occurrence wins).
|
|
1553
|
+
* An empty object is a silent no-op (returns null).
|
|
1554
|
+
*/
|
|
1555
|
+
function validateAndWrapAsImportMetadata(update) {
|
|
1556
|
+
if (!update || typeof update !== 'object') {
|
|
1557
|
+
throw new Error('LWR.importMap() requires an object argument');
|
|
1558
|
+
}
|
|
1559
|
+
const entries = Object.entries(update);
|
|
1560
|
+
if (entries.length === 0) {
|
|
1561
|
+
return null;
|
|
1562
|
+
}
|
|
1563
|
+
const seenSpecifiers = new Set();
|
|
1564
|
+
const validatedImports = {};
|
|
1565
|
+
for (const [moduleScriptURL, moduleNames] of entries) {
|
|
1566
|
+
if (!moduleScriptURL || typeof moduleScriptURL !== 'string') {
|
|
1567
|
+
throw new Error('moduleScriptURL must be a string');
|
|
1568
|
+
}
|
|
1569
|
+
if (!Array.isArray(moduleNames)) {
|
|
1570
|
+
throw new Error('moduleNames must be an array');
|
|
1571
|
+
}
|
|
1572
|
+
assertValidImportMapUrlKey(moduleScriptURL);
|
|
1573
|
+
const validatedNames = [];
|
|
1574
|
+
for (const moduleName of moduleNames) {
|
|
1575
|
+
if (typeof moduleName !== 'string' || moduleName.length === 0) {
|
|
1576
|
+
throw new Error('Specifier must be a non-empty string');
|
|
1577
|
+
}
|
|
1578
|
+
if (!seenSpecifiers.has(moduleName)) {
|
|
1579
|
+
seenSpecifiers.add(moduleName);
|
|
1580
|
+
validatedNames.push(moduleName);
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
if (validatedNames.length > 0) {
|
|
1584
|
+
validatedImports[moduleScriptURL] = validatedNames;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
if (Object.keys(validatedImports).length === 0) {
|
|
1588
|
+
return null;
|
|
1589
|
+
}
|
|
1590
|
+
return {
|
|
1591
|
+
imports: validatedImports
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Returns true when `update` carries the `ImportMetadata` shape (an `imports` object key),
|
|
1597
|
+
* signalling that it should be passed through to the resolver directly rather than treated
|
|
1598
|
+
* as a public-API `ImportMapUpdate`.
|
|
1599
|
+
*/
|
|
1600
|
+
function isImportMetadata(update) {
|
|
1601
|
+
const candidate = update;
|
|
1602
|
+
return candidate !== null && typeof candidate === 'object' && 'imports' in candidate && typeof candidate.imports === 'object' && !Array.isArray(candidate.imports);
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1521
1605
|
/**
|
|
1522
1606
|
* The LWR loader is inspired and borrows from the algorithms and native browser principles of https://github.com/systemjs/systemjs
|
|
1523
1607
|
*/
|
|
@@ -1639,8 +1723,75 @@ LWR.define('lwr/loader/v/0_22_12', ['exports'], (function (exports) { 'use stric
|
|
|
1639
1723
|
async resolve(id, importer) {
|
|
1640
1724
|
return this.registry.resolve(id, importer);
|
|
1641
1725
|
}
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* Apply import map updates at runtime, or register bootstrap import mappings.
|
|
1729
|
+
*
|
|
1730
|
+
* **Runtime usage** (public API, consistent with `LWR.importMap()` on the legacy loader):
|
|
1731
|
+
* `importMap({ [moduleScriptURL]: [moduleName1, moduleName2, ...] })`
|
|
1732
|
+
* Validates the update and registers the new mappings dynamically.
|
|
1733
|
+
*
|
|
1734
|
+
* **Bootstrap / internal usage** (replaces `registerImportMappings`):
|
|
1735
|
+
* `importMap(importMetadata)` or `importMap(importMetadata, rootSpecifiers)`
|
|
1736
|
+
* Detected at runtime by the `ImportMetadata` shape (presence of an `imports` object).
|
|
1737
|
+
* This branch **does not** run `validateAndWrapAsImportMetadata` (URL-key checks /
|
|
1738
|
+
* runtime-payload dedupe). That is intentional: bootstrap must preserve
|
|
1739
|
+
* `index` fingerprints and use `ImportMetadataResolver.registerImportMappings` merge
|
|
1740
|
+
* semantics unchanged from the pre-`importMap` API.
|
|
1741
|
+
*
|
|
1742
|
+
* **Who may use this branch:** Platform/shim code with trusted config (see
|
|
1743
|
+
* `shim/shim.ts`, which calls `loader.importMap({ imports, index }, roots)`). The
|
|
1744
|
+
* public `LWR.importMap` wrapper only forwards the flat runtime update shape; any
|
|
1745
|
+
* code with a direct `Loader` reference could still pass an `ImportMetadata`-shaped
|
|
1746
|
+
* object — same trust boundary as calling `registerImportMappings` before.
|
|
1747
|
+
*
|
|
1748
|
+
* @param update - Runtime: `ImportMapUpdate` mapping script URLs to the module names they define.
|
|
1749
|
+
* Bootstrap: `ImportMetadata` with an `imports` object (and optional `index`).
|
|
1750
|
+
* @param rootSpecifiers - Bootstrap only: root module specifiers for the initial registration.
|
|
1751
|
+
* Optional — omit when the root specifiers are not known.
|
|
1752
|
+
*/
|
|
1753
|
+
async importMap(update, rootSpecifiers) {
|
|
1754
|
+
if (isImportMetadata(update)) {
|
|
1755
|
+
this.registry.getImportMetadataResolver().registerImportMappings(update, rootSpecifiers);
|
|
1756
|
+
return;
|
|
1757
|
+
}
|
|
1758
|
+
const resolver = this.registry.getImportMetadataResolver();
|
|
1759
|
+
const importMetadata = validateAndWrapAsImportMetadata(update);
|
|
1760
|
+
if (!importMetadata) {
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
const dedupedImports = {};
|
|
1764
|
+
for (const [uri, specifiers] of Object.entries(importMetadata.imports)) {
|
|
1765
|
+
const newSpecifiers = [];
|
|
1766
|
+
for (const specifier of specifiers) {
|
|
1767
|
+
const existingUri = resolver.getMappingUri(specifier);
|
|
1768
|
+
if (existingUri !== undefined) ;else {
|
|
1769
|
+
newSpecifiers.push(specifier);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
if (newSpecifiers.length > 0) {
|
|
1773
|
+
dedupedImports[uri] = newSpecifiers;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
if (Object.keys(dedupedImports).length === 0) {
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
const filtered = {
|
|
1780
|
+
imports: dedupedImports
|
|
1781
|
+
};
|
|
1782
|
+
const specs = Object.values(filtered.imports).flat();
|
|
1783
|
+
resolver.registerImportMappings(filtered, specs);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* @deprecated Use `importMap(metadata, rootSpecifiers)` instead.
|
|
1788
|
+
*/
|
|
1642
1789
|
async registerImportMappings(mappings, rootSpecifiers) {
|
|
1643
|
-
|
|
1790
|
+
if (hasConsole) {
|
|
1791
|
+
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
1792
|
+
console.warn('registerImportMappings() is deprecated. Use importMap() instead.');
|
|
1793
|
+
}
|
|
1794
|
+
return this.importMap(mappings, rootSpecifiers);
|
|
1644
1795
|
}
|
|
1645
1796
|
|
|
1646
1797
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/preInit/v/
|
|
1
|
+
LWR.define('lwr/preInit/v/0_23_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This module is called in the ABS module (app bootstrap module) to perform neccesary pre initialization steps for an LWR app.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/vault/v/
|
|
1
|
+
LWR.define('lwr/vault/v/0_23_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// Credential vault for storing setters and subscribers for OAuth info
|
|
4
4
|
// This module is a SINGLETON and must be excluded from ESM bundling
|
|
@@ -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.
|
|
7
|
+
/* LWR Error Shim v0.23.0 */
|
|
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)}}();
|