@lwrjs/everywhere 0.9.0-alpha.26 → 0.9.0-alpha.28

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/96d66cbaf1b94dad6cdeef34aee259cd/config.js +10 -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_9_0-alpha_26 → 0_9_0-alpha_28}/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +4 -4
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_9_0-alpha_26 → 0_9_0-alpha_28}/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js +3 -3
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_9_0-alpha_26 → 0_9_0-alpha_28}/s/206e6e0af6f019fdfd86d87d56331bc2/lwr_init.js +3 -3
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_9_0-alpha_26/s/89d1323af34eb6daf9b222fcc6f05f58 → 0_9_0-alpha_28/s/77539cdda693efda0b8244be84948117}/lwr_loader.js +7 -11
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_9_0-alpha_26 → 0_9_0-alpha_28}/s/3426e42c3e22ce07ab2adc62c4c523a0/lwr_metrics.js +1 -1
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_9_0-alpha_26 → 0_9_0-alpha_28}/s/e25f3b0b8b5c096acebf847d0a83ea62/lwr_profiler.js +1 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_9_0-alpha_26 → 0_9_0-alpha_28}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_9_0-alpha_26 → 0_9_0-alpha_28}/lwr-error-shim.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/0_9_0-alpha_28/lwr-loader-shim.bundle.js +1547 -0
  11. package/build/assets/amd/lwr-everywhere-debug.js +14 -18
  12. package/build/assets/amd/lwr-everywhere-min.js +1 -1
  13. package/build/assets/amd/lwr-everywhere.js +14 -18
  14. package/build/assets/core/lwr-everywhere-debug.js +10 -14
  15. package/build/assets/core/lwr-everywhere-min.js +1 -1
  16. package/build/assets/core/lwr-everywhere.js +10 -14
  17. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  18. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  19. package/build/assets/esm/lwr-everywhere.js +1 -1
  20. package/package.json +5 -5
  21. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/2458c6e319e9056787252989c2e26389/config.js +0 -10
  22. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.js/v/0_9_0-alpha_26/lwr-loader-shim.js +0 -312
@@ -1,10 +0,0 @@
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_9_0-alpha_26","autoBoot":true,"imports":{"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_9_0-alpha_26/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_9_0-alpha_26"],"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_9_0-alpha_26/s/206e6e0af6f019fdfd86d87d56331bc2/lwr_init.js":["lwr/init/v/0_9_0-alpha_26"],"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_9_0-alpha_26/s/3426e42c3e22ce07ab2adc62c4c523a0/lwr_metrics.js":["lwr/metrics/v/0_9_0-alpha_26"],"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_9_0-alpha_26/s/e25f3b0b8b5c096acebf847d0a83ea62/lwr_profiler.js":["lwr/profiler/v/0_9_0-alpha_26"],"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa/lwc.js":["lwc/v/2_38_1"],"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_9_0-alpha_26/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js":["lwr/everywhereAmd/v/0_9_0-alpha_26"],"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_9_0-alpha_26/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js":["lwr/vault/v/0_9_0-alpha_26"]},"index":{"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_9_0-alpha_26":"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_9_0-alpha_26/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js","lwr/init/v/0_9_0-alpha_26":"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_9_0-alpha_26/s/206e6e0af6f019fdfd86d87d56331bc2/lwr_init.js","lwr/metrics/v/0_9_0-alpha_26":"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_9_0-alpha_26/s/3426e42c3e22ce07ab2adc62c4c523a0/lwr_metrics.js","lwr/profiler/v/0_9_0-alpha_26":"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_9_0-alpha_26/s/e25f3b0b8b5c096acebf847d0a83ea62/lwr_profiler.js","lwc/v/2_38_1":"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa/lwc.js","lwr/everywhereAmd/v/0_9_0-alpha_26":"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_9_0-alpha_26/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js","lwr/vault/v/0_9_0-alpha_26":"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_9_0-alpha_26/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js"},"rootComponents":["lwr/everywhereAmd/v/0_9_0-alpha_26"],"requiredModules":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_9_0-alpha_26"],"preloadModules":["lwr/everywhereAmd/v/0_9_0-alpha_26"],"endpoints":{"uris":{"mapping":"/1/mapping/amd/1/l/en-US/mp/"}}});
5
- globalThis.process = { env: { NODE_ENV: "compat" } };
6
- // Appended by Static Site Generator
7
- if (!globalThis.LWR.imports) { globalThis.LWR.imports = {}; }
8
- Object.assign(globalThis.LWR.imports, {"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_9_0-alpha_26/s/89d1323af34eb6daf9b222fcc6f05f58/lwr_loader.js":["lwr/loader/v/0_9_0-alpha_26"]})
9
- if (!globalThis.LWR.index) { globalThis.LWR.index = {}; }
10
- Object.assign(globalThis.LWR.index, {"lwr/loader/v/0_9_0-alpha_26":"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_9_0-alpha_26/s/89d1323af34eb6daf9b222fcc6f05f58/lwr_loader.js"})
@@ -1,312 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, salesforce.com, inc.
3
- * All rights reserved.
4
- * SPDX-License-Identifier: MIT
5
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
- */
7
- /* LWR Module Loader Shim v0.9.0-alpha.26 */
8
- (function () {
9
- 'use strict';
10
-
11
- // Bootstrap / shim
12
- const BOOTSTRAP_PREFIX = 'lwr.bootstrap.';
13
- const BOOTSTRAP_ERROR = `${BOOTSTRAP_PREFIX}error`;
14
-
15
- var Phase;
16
- (function (Phase) {
17
- Phase[Phase["Start"] = 0] = "Start";
18
- Phase[Phase["End"] = 1] = "End";
19
- })(Phase || (Phase = {}));
20
- // Attach a custom dispatcher
21
- let customDispatcher;
22
- function attachDispatcher(dispatcher) {
23
- customDispatcher = dispatcher;
24
- }
25
-
26
- // Check if the Performance API is available
27
- // e.g. JSDom (used in Jest) doesn't implement these
28
- const perf = globalThis.performance;
29
- const isPerfSupported = typeof perf !== 'undefined' && typeof perf.mark === 'function' && typeof perf.clearMarks === 'function' && typeof perf.measure === 'function' && typeof perf.clearMeasures === 'function';
30
-
31
- // For marking request metrics
32
- // Fallback to the Performance API if there is no custom dispatcher
33
- function logOperationStart({
34
- id,
35
- specifier
36
- }) {
37
- if (customDispatcher) {
38
- customDispatcher({
39
- id,
40
- phase: Phase.Start,
41
- specifier
42
- });
43
- } else if (isPerfSupported) {
44
- perf.mark(id + (specifier ? `.${specifier}` : ''));
45
- }
46
- }
47
-
48
- // For measuring duration metrics
49
- // Fallback to the Performance API if there is no custom dispatcher
50
- /* istanbul ignore next */
51
- function logOperationEnd({
52
- id,
53
- specifier
54
- }) {
55
- if (customDispatcher) {
56
- customDispatcher({
57
- id,
58
- phase: Phase.End,
59
- specifier
60
- });
61
- } else if (isPerfSupported) {
62
- const suffix = specifier ? `.${specifier}` : '';
63
- const markName = id + suffix;
64
- const measureName = `${id}.duration${suffix}`;
65
- perf.measure(measureName, markName);
66
-
67
- // Clear the created mark and measure to avoid filling the performance entry buffer
68
- // Even if they get deleted, existing PerformanceObservers preserve copies of the entries
69
- perf.clearMarks(markName);
70
- perf.clearMeasures(measureName);
71
- }
72
- }
73
-
74
- function createLoader(name, definition, config, externalModules) {
75
- if (!definition || typeof definition[2] !== 'function') {
76
- throw new Error(`Expected loader with specifier "${name}" to be a module`);
77
- }
78
- // Create a Loader instance
79
- const exports = {};
80
- definition[2].call(null, exports);
81
- const { Loader } = exports;
82
- const loader = new Loader(config);
83
- if (externalModules && externalModules.length) {
84
- loader.registerExternalModules(externalModules);
85
- }
86
- // Define the loader module with public API: { define, load, services }
87
- const exporter = (exports) => {
88
- Object.assign(exports, {
89
- define: loader.define.bind(loader),
90
- load: loader.load.bind(loader),
91
- services: loader.services,
92
- });
93
- };
94
- loader.define(name, ['exports'], exporter);
95
- return loader;
96
- }
97
-
98
- const REQUIRED_MODULES_TIMEOUT = 300 * 1000;
99
-
100
- // Check for errors with autoBoot and customInit
101
- function validatePreInit(autoBoot, customInit) {
102
- // If autoBoot === false, there must be a customInit hook
103
- if (!autoBoot && !customInit) {
104
- throw new Error('The customInit hook is required when autoBoot is false');
105
- }
106
- // If autoBoot === true, there must NOT be a customInit hook
107
- if (autoBoot && customInit) {
108
- throw new Error('The customInit hook must not be defined when autoBoot is true');
109
- }
110
- }
111
- // Process the customInit hook
112
- function customInit(config, initializeApp, define, onBootstrapError) {
113
- // Validate config
114
- const { autoBoot, customInit } = config;
115
- validatePreInit(autoBoot, customInit);
116
- // Set up arguments and call the customInit hook, if available
117
- if (customInit) {
118
- const lwr = {
119
- initializeApp,
120
- define,
121
- onBootstrapError,
122
- attachDispatcher,
123
- };
124
- customInit(lwr, config);
125
- }
126
- }
127
-
128
- /* global document */
129
- /* eslint-disable lwr/no-unguarded-apis */
130
- const hasSetTimeout = typeof setTimeout === 'function';
131
- const hasConsole = typeof console !== 'undefined';
132
- /* eslint-enable lwr/no-unguarded-apis */
133
- class LoaderShim {
134
- constructor(global) {
135
- this.defineCache = {};
136
- this.orderedDefs = [];
137
- // Start watchdog timer
138
- if (hasSetTimeout) {
139
- this.watchdogTimerId = this.startWatchdogTimer();
140
- }
141
- // Parse configuration
142
- this.global = global;
143
- this.config = global.LWR;
144
- this.loaderSpecifier = 'lwr/loader/v/0_9_0-alpha_26';
145
- // Set up error handler
146
- this.errorHandler = this.config.onError;
147
- // Set up the temporary LWR.define function and customInit hook
148
- const tempDefine = this.tempDefine.bind(this);
149
- global.LWR.define = tempDefine;
150
- this.bootReady = this.config.autoBoot;
151
- try {
152
- customInit(Object.freeze(this.config), this.postCustomInit.bind(this), tempDefine, (e) => {
153
- // customInit handlers can overwrite
154
- // the error handler with onBootstrapError
155
- this.errorHandler = e;
156
- });
157
- }
158
- catch (e) {
159
- this.enterErrorState(e);
160
- }
161
- }
162
- // Return true if the app can be initialized
163
- canInit() {
164
- // Initialize the app if:
165
- // - bootReady: autoBoot is on OR customInit has finished
166
- // - all required modules are defined
167
- const allDefined = this.config.requiredModules.every((m) => this.orderedDefs.includes(m));
168
- return this.bootReady && allDefined;
169
- }
170
- /**
171
- * Create a temporary LWR.define() function which captures all
172
- * calls that occur BEFORE the full loader module is available
173
- *
174
- * Each call to LWR.define() is stored in 2 ways:
175
- * - in a map as [moduleName, arguments] pairs
176
- * - each moduleName is pushed onto an array, to preserve
177
- * the order in which the modules were defined
178
- */
179
- tempDefine(...args) {
180
- // Cache the incoming module
181
- const moduleName = args[0];
182
- this.defineCache[moduleName] = args;
183
- this.orderedDefs.push(moduleName);
184
- if (this.canInit()) {
185
- if (hasSetTimeout) {
186
- // requiredModules are defined, clear watchdog timer
187
- // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
188
- clearTimeout(this.watchdogTimerId);
189
- }
190
- this.initApp();
191
- }
192
- }
193
- // Called by the customInit hook via lwr.initializeApp()
194
- postCustomInit() {
195
- this.bootReady = true;
196
- if (this.canInit()) {
197
- this.initApp();
198
- }
199
- }
200
- // Create the loader and initialize the application
201
- initApp() {
202
- try {
203
- const loaderConfig = {
204
- endpoints: this.config.endpoints,
205
- baseUrl: this.config.baseUrl,
206
- profiler: { logOperationStart, logOperationEnd },
207
- // TODO: can be removed following https://github.com/salesforce-experience-platform-emu/lwr/issues/1087
208
- appMetadata: {
209
- appId: this.config.appId,
210
- bootstrapModule: this.config.bootstrapModule,
211
- rootComponent: this.config.rootComponent,
212
- rootComponents: this.config.rootComponents,
213
- },
214
- };
215
- const loader = createLoader(this.loaderSpecifier, this.defineCache[this.loaderSpecifier], loaderConfig, this.config.preloadModules);
216
- this.createProfilerModule(loader);
217
- this.mountApp(loader);
218
- }
219
- catch (e) {
220
- this.enterErrorState(e);
221
- }
222
- }
223
- waitForDOMContentLoaded() {
224
- // eslint-disable-next-line lwr/no-unguarded-apis
225
- if (typeof document === undefined) {
226
- return Promise.resolve();
227
- }
228
- // Resolve if document is already "ready" https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
229
- // eslint-disable-next-line lwr/no-unguarded-apis
230
- if (document.readyState === 'interactive' || document.readyState === 'complete') {
231
- return Promise.resolve();
232
- }
233
- return new Promise((resolve) => {
234
- // eslint-disable-next-line lwr/no-unguarded-apis
235
- document.addEventListener('DOMContentLoaded', () => {
236
- resolve();
237
- });
238
- });
239
- }
240
- // Create a module out of the profiler
241
- // Note: The profiler is also available as a module through lwc module resolution (see package.json)
242
- createProfilerModule(loader) {
243
- const exporter = (exports) => {
244
- Object.assign(exports, { logOperationStart, logOperationEnd });
245
- };
246
- loader.define('lwr/profiler/v/0_9_0-alpha_26', ['exports'], exporter);
247
- }
248
- // Set up the application globals, import map, root custom element...
249
- mountApp(loader) {
250
- const { bootstrapModule, rootComponent, rootComponents, ssrProps, endpoints, imports, index } = this.config;
251
- // Set global LWR.define to loader.define
252
- this.global.LWR = Object.freeze({
253
- define: loader.define.bind(loader),
254
- rootComponent,
255
- rootComponents,
256
- ssrProps,
257
- endpoints,
258
- imports: imports || {},
259
- index: index || {},
260
- });
261
- // Redefine all modules in the temporary cache
262
- this.orderedDefs.forEach((specifier) => {
263
- if (specifier !== this.loaderSpecifier) {
264
- loader.define(...this.defineCache[specifier]);
265
- }
266
- });
267
- // by default, app initialization is gated on waiting for document to be parsed (via DOMContentLoaded)
268
- const { disableInitDefer } = this.config;
269
- // Load the import mappings and application bootstrap module
270
- loader
271
- .registerImportMappings({ imports, index }, [bootstrapModule, rootComponent])
272
- .then(() => {
273
- if (!disableInitDefer) {
274
- return this.waitForDOMContentLoaded();
275
- }
276
- })
277
- .then(() => loader.load(bootstrapModule))
278
- .catch((reason) => {
279
- this.enterErrorState(new Error(`Application ${rootComponent} could not be loaded: ${reason}`));
280
- });
281
- }
282
- // Trigger bootstrap error state, and call error handler if registered
283
- enterErrorState(error) {
284
- logOperationStart({ id: BOOTSTRAP_ERROR });
285
- if (this.errorHandler) {
286
- this.errorHandler(error);
287
- }
288
- else {
289
- if (hasConsole) {
290
- // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
291
- console.error(`An error occurred during LWR bootstrap. ${error.message}`, error.stack);
292
- }
293
- }
294
- }
295
- // eslint-disable-next-line no-undef, lwr/no-unguarded-apis
296
- startWatchdogTimer() {
297
- // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
298
- return setTimeout(() => {
299
- this.enterErrorState(new Error('Failed to load required modules - timed out'));
300
- }, REQUIRED_MODULES_TIMEOUT);
301
- }
302
- }
303
-
304
- // The loader module is ALWAYS required
305
- const GLOBAL = globalThis;
306
- GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
307
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_9_0-alpha_26') < 0) {
308
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_9_0-alpha_26');
309
- }
310
- new LoaderShim(GLOBAL);
311
-
312
- }());