@lwrjs/everywhere 0.20.0 → 0.20.2
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/19737ad98c42894d36e278e701b899ac/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_20_0 → 0_20_2}/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js +5 -5
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_20_0 → 0_20_2}/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_20_0/s/ba081ae41570981325062377381a1ea2 → 0_20_2/s/8a450e0577e39f3aee74a6cd2f88d4ff}/lwr_init.js +107 -20
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_20_0/s/9685b1c83c0f9ac9a036bb005137e44b → 0_20_2/s/753df58285e56c6ebbc5295c72c33401}/lwr_loader.js +55 -19
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_20_0 → 0_20_2}/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_20_0 → 0_20_2}/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_20_0 → 0_20_2}/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_20_0 → 0_20_2}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_20_0 → 0_20_2}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_20_0 → 0_20_2}/lwr-loader-shim.bundle.js +56 -27
- package/build/assets/amd/lwr-everywhere-debug.js +57 -29
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +57 -29
- package/build/assets/core/lwr-everywhere-debug.js +53 -25
- package/build/assets/core/lwr-everywhere-min.js +2 -2
- package/build/assets/core/lwr-everywhere.js +53 -25
- 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/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_2","autoBoot":true,"imports":{"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_20_2/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_2"],"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_20_2/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js":["lwr/preInit/v/0_20_2"],"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_20_2/s/8a450e0577e39f3aee74a6cd2f88d4ff/lwr_init.js":["lwr/init/v/0_20_2"],"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_20_2/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js":["lwr/metrics/v/0_20_2"],"/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_2/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js":["lwr/everywhereAmd/v/0_20_2"],"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_20_2/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js":["lwr/vault/v/0_20_2"]},"index":{"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_2":"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_20_2/s/3aba11034f11c8d5598c93bfca4d4690/@lwrjs_app-service_amd-bootstrap_module_amd.js","lwr/preInit/v/0_20_2":"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_20_2/s/7d064ec3a80dbbccaa4845ea5eaef125/lwr_preInit.js","lwr/init/v/0_20_2":"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_20_2/s/8a450e0577e39f3aee74a6cd2f88d4ff/lwr_init.js","lwr/metrics/v/0_20_2":"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_20_2/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_2":"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_20_2/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js","lwr/vault/v/0_20_2":"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_20_2/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js"},"rootComponents":["lwr/everywhereAmd/v/0_20_2"],"serverData":{},"requiredModules":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_2"],"preloadModules":["lwr/preInit/v/0_20_2","lwr/init/v/0_20_2","lwr/metrics/v/0_20_2","lwc/v/8_20_1","lwr/everywhereAmd/v/0_20_2"],"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_2/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js":["lwr/profiler/v/0_20_2"],"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_20_2/s/753df58285e56c6ebbc5295c72c33401/lwr_loader.js":["lwr/loader/v/0_20_2"]})
|
|
11
|
+
if (!globalThis.LWR.index) { globalThis.LWR.index = {}; }
|
|
12
|
+
Object.assign(globalThis.LWR.index, {"lwr/profiler/v/0_20_2":"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_20_2/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js","lwr/loader/v/0_20_2":"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_20_2/s/753df58285e56c6ebbc5295c72c33401/lwr_loader.js"})
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/
|
|
1
|
+
LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_2', ['lwr/loader/v/0_20_2', 'lwr/preInit/v/0_20_2', 'lwr/init/v/0_20_2'], (function (_0_20_2$2, _0_20_2, _0_20_2$1) { 'use strict';
|
|
2
2
|
|
|
3
|
-
const clientBootstrapConfig =
|
|
3
|
+
const clientBootstrapConfig = _0_20_2.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 =
|
|
9
|
-
const { default: Ctor } = await
|
|
8
|
+
const element = _0_20_2$1.toKebabCase(rootSpecifier);
|
|
9
|
+
const { default: Ctor } = await _0_20_2$2.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_20_2');
|
|
10
10
|
return [element, Ctor];
|
|
11
11
|
})).then((rootModules) => {
|
|
12
|
-
return
|
|
12
|
+
return _0_20_2$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/
|
|
1
|
+
LWR.define('lwr/everywhereAmd/v/0_20_2', ['exports', 'lwr/vault/v/0_20_2'], (function (exports, _0_20_2) { '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_20_2.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
|
-
|
|
56
|
+
_0_20_2.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_20_2', ['exports', 'lwr/metrics/v/0_20_2', 'lwr/profiler/v/0_20_2', 'lwc/v/8_20_1'], (function (exports, _0_20_2$1, _0_20_2, _8_20_1) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line lwr/only-allowed-type-imports
|
|
4
4
|
|
|
@@ -6,11 +6,89 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
6
6
|
// Note: a build step uses these comments to strip the code for core.
|
|
7
7
|
// eslint-disable-next-line lwr/only-allowed-imports
|
|
8
8
|
|
|
9
|
+
// hydration directive + value constants
|
|
10
|
+
// must align with the constants in @lwrjs/shared-utils/src/html-meta.ts
|
|
11
|
+
const HYDRATE_DIRECTIVE = 'lwr:hydrate';
|
|
12
|
+
const HYDRATE_VISIBLE_VALUE = 'visible';
|
|
9
13
|
function hydrateComponentProxy(customElement, Ctor, props) {
|
|
10
14
|
_8_20_1.hydrateComponent(customElement, Ctor, props);
|
|
11
15
|
}
|
|
12
16
|
// </hydrateComponentProxy>
|
|
13
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Hydrate the custom element only when it is visible.
|
|
20
|
+
* @param customElement - The custom element to hydrate
|
|
21
|
+
* @param ctor - The constructor of the custom element
|
|
22
|
+
* @param props - The properties of the custom element
|
|
23
|
+
*/
|
|
24
|
+
function hydrateComponentOnVisible(customElement, ctor, props) {
|
|
25
|
+
// Use IntersectionObserver for visibility-based hydration
|
|
26
|
+
const observer = createVisibilityObserver();
|
|
27
|
+
|
|
28
|
+
// add the element to the pending hydrations and observe it
|
|
29
|
+
pendingHydrations.set(customElement, {
|
|
30
|
+
ctor,
|
|
31
|
+
props
|
|
32
|
+
});
|
|
33
|
+
observer.observe(customElement);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// store component metadata for pending hydrations
|
|
37
|
+
const pendingHydrations = new Map();
|
|
38
|
+
|
|
39
|
+
// store the visibility observer so that we don't create a new one each time
|
|
40
|
+
let visibilityObserver;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Determines if a component should be hydrated when it becomes visible in the viewport.
|
|
44
|
+
* This requires IntersectionObserver to be available and the hydrate directive to be set to 'visible'.
|
|
45
|
+
* @param element - The element to check for visibility-based hydration
|
|
46
|
+
* @returns True if the component should be hydrated when visible, false otherwise
|
|
47
|
+
*/
|
|
48
|
+
function shouldHydrateComponentWhenVisible(element) {
|
|
49
|
+
return 'IntersectionObserver' in globalThis && element.getAttribute(HYDRATE_DIRECTIVE) === HYDRATE_VISIBLE_VALUE;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create an intersection observer for hydrating islands when visible, if one doesn't already exist.
|
|
54
|
+
* @returns An intersection observer that will hydrate the island when visible
|
|
55
|
+
*/
|
|
56
|
+
function createVisibilityObserver() {
|
|
57
|
+
// return the existing observer if it already exists
|
|
58
|
+
if (visibilityObserver) return visibilityObserver;
|
|
59
|
+
|
|
60
|
+
// create a new observer if it doesn't already exist
|
|
61
|
+
visibilityObserver = new IntersectionObserver((entries, observer) => {
|
|
62
|
+
// for each observed element, check if it is intersecting with the viewport
|
|
63
|
+
entries.forEach(entry => {
|
|
64
|
+
// if intersecting, hydrate the island
|
|
65
|
+
if (entry.isIntersecting) {
|
|
66
|
+
const element = entry.target;
|
|
67
|
+
|
|
68
|
+
// stop observing the element
|
|
69
|
+
observer.unobserve(element);
|
|
70
|
+
|
|
71
|
+
// get the hydration data for the element
|
|
72
|
+
const hydrationData = pendingHydrations.get(element);
|
|
73
|
+
if (hydrationData) {
|
|
74
|
+
// delete the hydration data for the element
|
|
75
|
+
pendingHydrations.delete(element);
|
|
76
|
+
const {
|
|
77
|
+
ctor,
|
|
78
|
+
props
|
|
79
|
+
} = hydrationData;
|
|
80
|
+
// hydrate the island
|
|
81
|
+
hydrateComponentProxy(element, ctor, props);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}, {
|
|
86
|
+
root: null,
|
|
87
|
+
// adds a buffer to the intersection observer to hydrate the island slightly before it enters the viewport
|
|
88
|
+
rootMargin: '100px'
|
|
89
|
+
});
|
|
90
|
+
return visibilityObserver;
|
|
91
|
+
}
|
|
14
92
|
const shouldYield = (() => {
|
|
15
93
|
const globalThisLWR = globalThis;
|
|
16
94
|
const {
|
|
@@ -76,13 +154,13 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
76
154
|
function init(rootModules, serverData = {}) {
|
|
77
155
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
78
156
|
if (typeof globalThis.customElements === 'undefined' || typeof globalThis.document === 'undefined') {
|
|
79
|
-
|
|
80
|
-
id:
|
|
157
|
+
_0_20_2.logOperationStart({
|
|
158
|
+
id: _0_20_2$1.BOOTSTRAP_END
|
|
81
159
|
});
|
|
82
160
|
return;
|
|
83
161
|
}
|
|
84
|
-
|
|
85
|
-
id:
|
|
162
|
+
_0_20_2.logOperationStart({
|
|
163
|
+
id: _0_20_2$1.INIT
|
|
86
164
|
});
|
|
87
165
|
(async () => {
|
|
88
166
|
let index = 0;
|
|
@@ -100,8 +178,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
100
178
|
// initialize and inject the root module into the LWR Root or DOM if it is missing
|
|
101
179
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
102
180
|
if (!document.body.querySelector(elementName)) {
|
|
103
|
-
|
|
104
|
-
id:
|
|
181
|
+
_0_20_2.logOperationStart({
|
|
182
|
+
id: _0_20_2$1.INIT_MODULE,
|
|
105
183
|
specifier,
|
|
106
184
|
specifierIndex
|
|
107
185
|
});
|
|
@@ -112,8 +190,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
112
190
|
const container = document.querySelector('[lwr-root]');
|
|
113
191
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
114
192
|
container ? container.appendChild(component) : document.body.appendChild(component);
|
|
115
|
-
|
|
116
|
-
id:
|
|
193
|
+
_0_20_2.logOperationEnd({
|
|
194
|
+
id: _0_20_2$1.INIT_MODULE,
|
|
117
195
|
specifier,
|
|
118
196
|
specifierIndex,
|
|
119
197
|
metadata: {
|
|
@@ -127,8 +205,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
127
205
|
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
128
206
|
const elements = document.querySelectorAll(elementName);
|
|
129
207
|
for (const element of elements) {
|
|
130
|
-
|
|
131
|
-
id:
|
|
208
|
+
_0_20_2.logOperationStart({
|
|
209
|
+
id: _0_20_2$1.INIT_MODULE,
|
|
132
210
|
specifier,
|
|
133
211
|
specifierIndex
|
|
134
212
|
});
|
|
@@ -136,9 +214,16 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
136
214
|
|
|
137
215
|
// hydrate SSR'd components
|
|
138
216
|
if (propsId) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
217
|
+
// check if the element is a hydration visible island
|
|
218
|
+
if (shouldHydrateComponentWhenVisible(element)) {
|
|
219
|
+
// hydrate the island when visible
|
|
220
|
+
hydrateComponentOnVisible(element, ctor, serverData[propsId] || {});
|
|
221
|
+
} else {
|
|
222
|
+
// hydrate the island immediately
|
|
223
|
+
hydrateComponentProxy(element, ctor, serverData[propsId] || {});
|
|
224
|
+
}
|
|
225
|
+
_0_20_2.logOperationEnd({
|
|
226
|
+
id: _0_20_2$1.INIT_MODULE,
|
|
142
227
|
specifier,
|
|
143
228
|
specifierIndex,
|
|
144
229
|
metadata: {
|
|
@@ -176,8 +261,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
176
261
|
if (parent) {
|
|
177
262
|
parent.replaceChild(component, element);
|
|
178
263
|
}
|
|
179
|
-
|
|
180
|
-
id:
|
|
264
|
+
_0_20_2.logOperationEnd({
|
|
265
|
+
id: _0_20_2$1.INIT_MODULE,
|
|
181
266
|
specifier,
|
|
182
267
|
specifierIndex,
|
|
183
268
|
metadata: {
|
|
@@ -187,11 +272,11 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
187
272
|
}
|
|
188
273
|
}
|
|
189
274
|
})();
|
|
190
|
-
|
|
191
|
-
id:
|
|
275
|
+
_0_20_2.logOperationEnd({
|
|
276
|
+
id: _0_20_2$1.INIT
|
|
192
277
|
});
|
|
193
|
-
|
|
194
|
-
id:
|
|
278
|
+
_0_20_2.logOperationStart({
|
|
279
|
+
id: _0_20_2$1.BOOTSTRAP_END
|
|
195
280
|
});
|
|
196
281
|
}
|
|
197
282
|
|
|
@@ -202,6 +287,8 @@ LWR.define('lwr/init/v/0_20_0', ['exports', 'lwr/metrics/v/0_20_0', 'lwr/profile
|
|
|
202
287
|
return scheduler?.yield ? scheduler.yield() : new Promise(resolve => setTimeout(resolve, 0));
|
|
203
288
|
}
|
|
204
289
|
|
|
290
|
+
exports.HYDRATE_DIRECTIVE = HYDRATE_DIRECTIVE;
|
|
291
|
+
exports.HYDRATE_VISIBLE_VALUE = HYDRATE_VISIBLE_VALUE;
|
|
205
292
|
exports.getPropFromAttrName = getPropFromAttrName;
|
|
206
293
|
exports.init = init;
|
|
207
294
|
exports.toKebabCase = toKebabCase;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/loader/v/
|
|
1
|
+
LWR.define('lwr/loader/v/0_20_2', ['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.
|
|
9
|
+
/* LWR Module Loader v0.20.2 */
|
|
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
|
}
|
|
@@ -1125,24 +1176,8 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
|
|
|
1125
1176
|
|
|
1126
1177
|
// execute the "top-level code" (the code outside of functions) of a module
|
|
1127
1178
|
async topLevelEvaluation(moduleRecord) {
|
|
1128
|
-
await this.instantiateAll(moduleRecord, {});
|
|
1129
1179
|
return this.evaluateModule(moduleRecord, {});
|
|
1130
1180
|
}
|
|
1131
|
-
|
|
1132
|
-
// Returns a promise when a module and all of it's dependencies have finished instantiation
|
|
1133
|
-
async instantiateAll(moduleRecord, instantiatedMap) {
|
|
1134
|
-
if (!instantiatedMap[moduleRecord.id]) {
|
|
1135
|
-
instantiatedMap[moduleRecord.id] = true;
|
|
1136
|
-
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
|
1137
|
-
if (dependencyModuleRecords) {
|
|
1138
|
-
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
|
1139
|
-
const depRecord = dependencyModuleRecords[i];
|
|
1140
|
-
// eslint-disable-next-line no-await-in-loop
|
|
1141
|
-
await this.instantiateAll(depRecord, instantiatedMap);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
1181
|
async evaluateModule(moduleRecord, evaluationMap) {
|
|
1147
1182
|
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
|
1148
1183
|
if (dependencyModuleRecords.length > 0) {
|
|
@@ -1464,7 +1499,8 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
|
|
|
1464
1499
|
this.registry = new ModuleRegistry(Object.freeze({
|
|
1465
1500
|
endpoints: config.endpoints,
|
|
1466
1501
|
baseUrl,
|
|
1467
|
-
profiler
|
|
1502
|
+
profiler,
|
|
1503
|
+
flags: config.flags || {}
|
|
1468
1504
|
}));
|
|
1469
1505
|
|
|
1470
1506
|
// TODO: W-10539691 - temp workaround for LWR-Java -- remove once appId is implemented there
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/preInit/v/
|
|
1
|
+
LWR.define('lwr/preInit/v/0_20_2', ['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_20_2', ['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.
|
|
7
|
+
/* LWR Error Shim v0.20.2 */
|
|
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.
|
|
7
|
+
/* LWR Module Loader Shim v0.20.2 */
|
|
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/
|
|
216
|
+
this.loaderSpecifier = 'lwr/loader/v/0_20_2';
|
|
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/
|
|
368
|
+
define('lwr/profiler/v/0_20_2', ['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/
|
|
460
|
-
GLOBAL.LWR.requiredModules.push('lwr/loader/v/
|
|
460
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_20_2') < 0) {
|
|
461
|
+
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_20_2');
|
|
461
462
|
}
|
|
462
463
|
new LoaderShim(GLOBAL);
|
|
463
464
|
|
|
464
465
|
})();
|
|
465
466
|
|
|
466
|
-
LWR.define('lwr/loader/v/
|
|
467
|
+
LWR.define('lwr/loader/v/0_20_2', ['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
|
-
|
|
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
|
}
|
|
@@ -1701,28 +1742,9 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
|
|
|
1701
1742
|
|
|
1702
1743
|
// execute the "top-level code" (the code outside of functions) of a module
|
|
1703
1744
|
async topLevelEvaluation(moduleRecord) {
|
|
1704
|
-
await this.instantiateAll(moduleRecord, {});
|
|
1705
1745
|
return this.evaluateModule(moduleRecord, {});
|
|
1706
1746
|
}
|
|
1707
1747
|
|
|
1708
|
-
// Returns a promise when a module and all of it's dependencies have finished instantiation
|
|
1709
|
-
async instantiateAll(
|
|
1710
|
-
moduleRecord,
|
|
1711
|
-
instantiatedMap,
|
|
1712
|
-
) {
|
|
1713
|
-
if (!instantiatedMap[moduleRecord.id]) {
|
|
1714
|
-
instantiatedMap[moduleRecord.id] = true;
|
|
1715
|
-
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
|
1716
|
-
if (dependencyModuleRecords) {
|
|
1717
|
-
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
|
1718
|
-
const depRecord = dependencyModuleRecords[i];
|
|
1719
|
-
// eslint-disable-next-line no-await-in-loop
|
|
1720
|
-
await this.instantiateAll(depRecord, instantiatedMap);
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
1748
|
async evaluateModule(
|
|
1727
1749
|
moduleRecord,
|
|
1728
1750
|
evaluationMap,
|
|
@@ -2070,7 +2092,14 @@ LWR.define('lwr/loader/v/0_20_0', ['exports'], (function (exports) { 'use strict
|
|
|
2070
2092
|
};
|
|
2071
2093
|
}
|
|
2072
2094
|
|
|
2073
|
-
this.registry = new ModuleRegistry(
|
|
2095
|
+
this.registry = new ModuleRegistry(
|
|
2096
|
+
Object.freeze({
|
|
2097
|
+
endpoints: config.endpoints,
|
|
2098
|
+
baseUrl,
|
|
2099
|
+
profiler,
|
|
2100
|
+
flags: config.flags || {},
|
|
2101
|
+
}),
|
|
2102
|
+
);
|
|
2074
2103
|
|
|
2075
2104
|
// TODO: W-10539691 - temp workaround for LWR-Java -- remove once appId is implemented there
|
|
2076
2105
|
if (config.appMetadata && !config.appMetadata.appId) {
|