@lwrjs/loader 0.7.0-alpha.1 → 0.7.0-alpha.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/assets/prod/lwr-error-shim.js +1 -1
- package/build/assets/prod/lwr-loader-shim-legacy.bundle.js +6 -6
- package/build/assets/prod/lwr-loader-shim-legacy.bundle.min.js +2 -2
- package/build/assets/prod/lwr-loader-shim-legacy.js +5 -5
- package/build/assets/prod/lwr-loader-shim.bundle.js +52 -35
- package/build/assets/prod/lwr-loader-shim.bundle.min.js +2 -2
- package/build/assets/prod/lwr-loader-shim.js +5 -5
- package/build/cjs/modules/lwr/loader/moduleRegistry/importMetadataResolver.cjs +40 -25
- package/build/cjs/modules/lwr/loader/moduleRegistry/moduleRegistry.cjs +2 -2
- package/build/modules/lwr/esmLoader/esmLoader.js +1 -1
- package/build/modules/lwr/loader/loader.js +47 -30
- package/build/modules/lwr/loaderLegacy/loaderLegacy.js +1 -1
- package/package.json +6 -6
|
@@ -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.0-alpha.
|
|
7
|
+
/* LWR Error Shim v0.7.0-alpha.2 */
|
|
8
8
|
!function(){"use strict";if(!(globalThis.LWR&&globalThis.LWR.define)){const o=new Error("The LWR application failed to bootstrap");if(!globalThis.LWR||!globalThis.LWR.onError)throw o;globalThis.LWR.onError(o)}}();
|
|
@@ -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 Legacy Module Loader Shim v0.7.0-alpha.
|
|
7
|
+
/* LWR Legacy Module Loader Shim v0.7.0-alpha.2 */
|
|
8
8
|
(function () {
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
// Parse configuration
|
|
143
143
|
this.global = global;
|
|
144
144
|
this.config = global.LWR;
|
|
145
|
-
this.loaderModule = 'lwr/loaderLegacy/v/0_7_0-
|
|
145
|
+
this.loaderModule = 'lwr/loaderLegacy/v/0_7_0-alpha_2';
|
|
146
146
|
// Set up error handler
|
|
147
147
|
this.errorHandler = this.config.onError;
|
|
148
148
|
// Set up the temporary LWR.define function and customInit hook
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
const exporter = (exports) => {
|
|
244
244
|
Object.assign(exports, { logOperationStart, logOperationEnd });
|
|
245
245
|
};
|
|
246
|
-
loader.define('lwr/profiler/v/0_7_0-
|
|
246
|
+
loader.define('lwr/profiler/v/0_7_0-alpha_2', ['exports'], exporter, {});
|
|
247
247
|
}
|
|
248
248
|
// Set up the application globals, import map, root custom element...
|
|
249
249
|
mountApp(loader) {
|
|
@@ -302,14 +302,14 @@
|
|
|
302
302
|
// The loader module is ALWAYS required
|
|
303
303
|
const GLOBAL = globalThis;
|
|
304
304
|
GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
|
|
305
|
-
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_7_0-
|
|
306
|
-
GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_7_0-
|
|
305
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_7_0-alpha_2') < 0) {
|
|
306
|
+
GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_7_0-alpha_2');
|
|
307
307
|
}
|
|
308
308
|
new LoaderShim(GLOBAL);
|
|
309
309
|
|
|
310
310
|
}());
|
|
311
311
|
|
|
312
|
-
LWR.define('lwr/loaderLegacy/v/0_7_0-
|
|
312
|
+
LWR.define('lwr/loaderLegacy/v/0_7_0-alpha_2', ['exports'], function (exports) { 'use strict';
|
|
313
313
|
|
|
314
314
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
315
315
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -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 Legacy Module Loader Shim v0.7.0-alpha.
|
|
8
|
-
!function(){"use strict";var e;let t;function r(e){t=e}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(e||(e={}));const o=globalThis.performance,s=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n({id:r,specifier:n}){t?t({id:r,phase:e.Start,specifier:n}):s&&o.mark(r+(n?`.${n}`:""))}function i({id:r,specifier:n}){if(t)t({id:r,phase:e.End,specifier:n});else if(s){const e=n?`.${n}`:"",t=r+e,s=`${r}.duration${e}`;o.measure(s,t),o.clearMarks(t),o.clearMeasures(s)}}function a(e,t,o,s){const{autoBoot:n,customInit:i}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(n,i),i){i({initializeApp:t,define:o,onBootstrapError:s,attachDispatcher:r},e)}}const l="function"==typeof setTimeout,d="undefined"!=typeof console;const c=globalThis;c.LWR.requiredModules=c.LWR.requiredModules||[],c.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_7_0-alpha_1")<0&&c.LWR.requiredModules.push("lwr/loaderLegacy/v/0_7_0-alpha_1"),new class{constructor(e){this.defineCache={},this.orderedDefs=[],l&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderModule="lwr/loaderLegacy/v/0_7_0-alpha_1",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{a(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(l&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&this.initApp()}initApp(){try{const e={baseUrl:this.config.baseUrl,profiler:{logOperationStart:n,logOperationEnd:i},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const s={};t[2].call(null,s);const{Loader:n}=s,i=new n(r);return o&&o.length&&i.registerExternalModules(o),i.define(e,["exports"],(e=>{Object.assign(e,{define:i.define.bind(i),load:i.load.bind(i),services:i.services})}),t[3]),i}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules);this.createProfilerModule(t),this.mountApp(t)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e.define("lwr/profiler/v/0_7_0-alpha_1",["exports"],(e=>{Object.assign(e,{logOperationStart:n,logOperationEnd:i})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,importMappings:o,rootComponents:s,endpoints:n}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:s,importMappings:o,endpoints:n}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{disableInitDefer:i}=this.config;e.registerImportMappings(o).then((()=>{if(!i)return this.waitForDOMContentLoaded()})).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r} could not be loaded: ${e}`))}))}enterErrorState(e){n({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):d&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),3e5)}}(c)}(),LWR.define("lwr/loaderLegacy/v/0_7_0-alpha_1",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"}),MODULE_ALREADY_LOADED=Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"}),FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),BAD_IMPORT_MAP=Object.freeze({code:3011,level:0,message:"import map is not valid"}),hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const s=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let i=-1;for(let e=0;e<s.length;e++)-1!==i?"/"===s[e]&&(n.push(s.slice(i,e+1)),i=-1):"."===s[e]?"."!==s[e+1]||"/"!==s[e+2]&&e+2!==s.length?"/"===s[e+1]||e+1===s.length?e+=1:i=e:(n.pop(),e+=2):i=e;return-1!==i&&n.push(s.slice(i)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const MODULE_LOAD_TIMEOUT_TIMER=3e5;let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(code)}catch(e){throw new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0})).finally((()=>{}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const s=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(s)}))})):t}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldHash:o,newHash:s}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldHash:o,newHash:s}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`;class ModuleRegistry{constructor(e){this.namedDefineRegistry=new Map,this.moduleRegistry=new Map,this.baseUrl=e.baseUrl,this.profiler=e.profiler}async load(e,t){const r=await this.resolve(e,t),o=this.getModuleRecord(r,e);return o.evaluated?o.module:(o.evaluationPromise||(o.evaluationPromise=this.topLevelEvaluation(o)),o.evaluationPromise)}async resolve(e,t){const r=this.baseUrl;let o,s=e;const n=this.resolveHook;if(n){for(let e=0;e<n.length;e++){const t=(0,n[e])(s,{parentUrl:r});let i;if((t||null===t)&&(i=isResponseAPromise(t)?await t:t),null!==i){if("string"==typeof i){if(resolveIfNotPlainOrUrl(i,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);s=i;continue}if(o=i&&i.url&&(resolveIfNotPlainOrUrl(i.url,r)||i.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(s!==e){if(!o&&this.namedDefineRegistry.has(s))return s;e=s}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;if(this.resolver){if(o=this.resolver.resolve(t,r),this.namedDefineRegistry.has(t)&&this.namedDefineRegistry.get(t).defined){const e=this.moduleRegistry.get(o);if(!e||!e.aliases.has(t))return t}}else o=t}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r,o){const s=this.namedDefineRegistry.get(e);if(s&&s.defined)return void(this.lastDefine=s);const n={name:e,dependencies:t,exporter:r,signatures:o,defined:!0};s&&s.external&&s.external.resolveExternal(n),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,n),this.lastDefine=n,o.hashes&&Object.entries(o.hashes).forEach((([e,t])=>{this.checkModuleSignature(e,t)}))}registerExternalModules(e){const t=[];if(e.map((e=>{if(this.namedDefineRegistry.has(e))t.push(e);else{let t,r;const o=new Promise(((o,s)=>{t=o,r=setTimeout((()=>{s(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),s={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,s)}})),t.length)throw new LoaderError(MODULE_ALREADY_LOADED,[t.join(", ")])}checkModuleSignature(e,t){const r=this.namedDefineRegistry.get(e);if(!r){const r={name:e,signatures:{ownHash:t},defined:!1};return void this.namedDefineRegistry.set(e,r)}const o=r.signatures?r.signatures.ownHash:void 0;if(o&&t!==o){const r=this.handleStaleModuleHook;r?evaluateHandleStaleModuleHooks(r,{name:e,oldHash:o,newHash:t}):hasConsole&&console.warn(`stale module detected ${e}, current sig:${o}, new sig:${t}`)}}setImportResolver(e){this.resolver=e}getModuleRecord(e,t){let r=this.moduleRegistry.get(e);if(r)return r.aliases.has(t)||r.aliases.add(t),r;const o=this.getModuleDef(e,t),s=o.then((e=>{const t=e.dependencies.map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)}));return r={id:e,aliases:new Set([t]),module:Object.create(null),dependencyRecords:s,instantiation:o,evaluated:!1,evaluationPromise:null},this.moduleRegistry.set(e,r),r}async getModuleDependencyRecord(e){const t=await this.resolve(e);return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return await this.instantiateAll(e,{}),this.evaluateModule(e,{})}async instantiateAll(e,t){if(!t[e.id]){t[e.id]=!0;const r=await e.dependencyRecords;if(r)for(let e=0;e<r.length;e++){const o=r[e];await this.instantiateAll(o,t)}}}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:s}=await e.instantiation,n={},i=await Promise.all(s.map((async e=>{if("exports"===e)return n;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])})));if(e.evaluated)return e.module;let a=o(...i);void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(n)&&Object.defineProperty(n,"__useDefault",{value:!0});const l=a||n;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const s=this.baseUrl,n=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:n}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,s),n=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===n)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(n&&null!==n)return evaluateLoadHookResponse(n,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:n}),o})).catch((e=>{throw this.profiler.logOperationStart({id:MODULE_ERROR,specifier:n}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t])}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}}function getMatch(e,t){if(t[e])return e;let r=e.length;do{const o=e.slice(0,r+1);if(o in t)return o}while(-1!==(r=e.lastIndexOf("/",r-1)))}function targetWarning(e,t,r){hasConsole&&console.warn("Package target "+r+", resolving target '"+t+"' for "+e)}function applyPackages(e,t,r){const o=getMatch(e,t);if(o){const r=t[o];if(null===r)return;if(!(e.length>o.length&&"/"!==r[r.length-1])){return e.length>o.length&&"/"===r[r.length-1]&&r.lastIndexOf(o)===r.length-o.length?r.substring(0,r.lastIndexOf(o))+encodeURIComponent(e):r+e.slice(o.length)}targetWarning(o,r,"should have a trailing '/'")}else if(r&&!isUrl(e))return r+encodeURIComponent(e)}function resolveImportMapEntry(e,t,r){e.scopes||(e.scopes={}),e.imports||(e.imports={});const o=e.scopes;let s=r&&getMatch(r,o);for(;s;){const e=applyPackages(t,o[s]);if(e)return e;s=getMatch(s.slice(0,s.lastIndexOf("/")),o)}return applyPackages(t,e.imports,e.default)||isUrl(t)&&t||void 0}function resolveAndComposePackages(e,t,r,o,s){for(const n in e){const i=resolveIfNotPlainOrUrl(n,r)||n,a=e[n];if("string"!=typeof a)continue;const l=resolveImportMapEntry(o,resolveIfNotPlainOrUrl(a,r)||a,s);l?t[i]=l:targetWarning(n,a,"bare specifier did not resolve")}}function resolveAndComposeImportMap(e,t,r={imports:{},scopes:{}}){const o={imports:Object.assign({},r.imports),scopes:Object.assign({},r.scopes),default:e.default};if(e.imports&&resolveAndComposePackages(e.imports,o.imports,t,r),e.scopes)for(const s in e.scopes){const n=resolveUrl(s,t);resolveAndComposePackages(e.scopes[s],o.scopes[n]||(o.scopes[n]={}),t,r,n)}return e.default&&(o.default=resolveIfNotPlainOrUrl(e.default,t)),o}class ImportMapResolver{constructor(e){this.importMap=e}resolve(e,t){return resolveImportMapEntry(this.importMap,e,t)}}const IMPORTMAP_SCRIPT_TYPE="lwr-importmap";function iterateDocumentImportMaps(e,t){const r=document.querySelectorAll(`script[type="${IMPORTMAP_SCRIPT_TYPE}"]`+t),o=Array.from(r).filter((e=>!e.src||(hasConsole&&console.warn("LWR does not support import maps from script src"),!1)));Array.prototype.forEach.call(o,e)}async function getImportMapFromScript(e){return Promise.resolve(e.innerHTML)}async function evaluateImportMaps(e){let t={imports:{},scopes:{}},r=Promise.resolve(t);if(hasDocument){if(e||(e=getBaseUrl()),!e)throw new LoaderError(NO_BASE_URL);iterateDocumentImportMaps((o=>{r=r.then((()=>getImportMapFromScript(o))).then((e=>{try{return JSON.parse(e)}catch(e){throw new LoaderError(BAD_IMPORT_MAP)}})).then((r=>(t=resolveAndComposeImportMap(r,o.src||e,t),t)))}),"")}return r}class Loader{constructor(e){let t=(e=e||{}).baseUrl,r=e.profiler;if(t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);this.baseUrl=t,r||(r={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry({baseUrl:t,profiler:r}),this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata})}define(e,t,r,o){invariant("string"==typeof e,MISSING_NAME);let s=r,n=t,i=o;"function"==typeof n&&(s=t,n=[],i=r),i=i||{},invariant(Array.isArray(n),INVALID_DEPS),this.registry.define(e,n,s,i)}async load(e,t){return this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e){let t;if(t=e?resolveAndComposeImportMap(e,this.baseUrl,this.parentImportMap):await evaluateImportMaps(this.baseUrl),this.parentImportMap=t,this.parentImportMap){const e=new ImportMapResolver(this.parentImportMap);this.registry.setImportResolver(e)}}registerExternalModules(e){this.registry.registerExternalModules(e)}}exports.Loader=Loader,Object.defineProperty(exports,"__esModule",{value:!0})}));
|
|
7
|
+
/* LWR Legacy Module Loader Shim v0.7.0-alpha.2 */
|
|
8
|
+
!function(){"use strict";var e;let t;function r(e){t=e}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(e||(e={}));const o=globalThis.performance,s=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n({id:r,specifier:n}){t?t({id:r,phase:e.Start,specifier:n}):s&&o.mark(r+(n?`.${n}`:""))}function i({id:r,specifier:n}){if(t)t({id:r,phase:e.End,specifier:n});else if(s){const e=n?`.${n}`:"",t=r+e,s=`${r}.duration${e}`;o.measure(s,t),o.clearMarks(t),o.clearMeasures(s)}}function a(e,t,o,s){const{autoBoot:n,customInit:i}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(n,i),i){i({initializeApp:t,define:o,onBootstrapError:s,attachDispatcher:r},e)}}const l="function"==typeof setTimeout,d="undefined"!=typeof console;const c=globalThis;c.LWR.requiredModules=c.LWR.requiredModules||[],c.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_7_0-alpha_2")<0&&c.LWR.requiredModules.push("lwr/loaderLegacy/v/0_7_0-alpha_2"),new class{constructor(e){this.defineCache={},this.orderedDefs=[],l&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderModule="lwr/loaderLegacy/v/0_7_0-alpha_2",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{a(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(l&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&this.initApp()}initApp(){try{const e={baseUrl:this.config.baseUrl,profiler:{logOperationStart:n,logOperationEnd:i},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const s={};t[2].call(null,s);const{Loader:n}=s,i=new n(r);return o&&o.length&&i.registerExternalModules(o),i.define(e,["exports"],(e=>{Object.assign(e,{define:i.define.bind(i),load:i.load.bind(i),services:i.services})}),t[3]),i}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules);this.createProfilerModule(t),this.mountApp(t)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e.define("lwr/profiler/v/0_7_0-alpha_2",["exports"],(e=>{Object.assign(e,{logOperationStart:n,logOperationEnd:i})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,importMappings:o,rootComponents:s,endpoints:n}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:s,importMappings:o,endpoints:n}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{disableInitDefer:i}=this.config;e.registerImportMappings(o).then((()=>{if(!i)return this.waitForDOMContentLoaded()})).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r} could not be loaded: ${e}`))}))}enterErrorState(e){n({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):d&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),3e5)}}(c)}(),LWR.define("lwr/loaderLegacy/v/0_7_0-alpha_2",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"}),MODULE_ALREADY_LOADED=Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"}),FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),BAD_IMPORT_MAP=Object.freeze({code:3011,level:0,message:"import map is not valid"}),hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const s=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let i=-1;for(let e=0;e<s.length;e++)-1!==i?"/"===s[e]&&(n.push(s.slice(i,e+1)),i=-1):"."===s[e]?"."!==s[e+1]||"/"!==s[e+2]&&e+2!==s.length?"/"===s[e+1]||e+1===s.length?e+=1:i=e:(n.pop(),e+=2):i=e;return-1!==i&&n.push(s.slice(i)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const MODULE_LOAD_TIMEOUT_TIMER=3e5;let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(code)}catch(e){throw new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0})).finally((()=>{}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const s=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(s)}))})):t}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldHash:o,newHash:s}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldHash:o,newHash:s}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`;class ModuleRegistry{constructor(e){this.namedDefineRegistry=new Map,this.moduleRegistry=new Map,this.baseUrl=e.baseUrl,this.profiler=e.profiler}async load(e,t){const r=await this.resolve(e,t),o=this.getModuleRecord(r,e);return o.evaluated?o.module:(o.evaluationPromise||(o.evaluationPromise=this.topLevelEvaluation(o)),o.evaluationPromise)}async resolve(e,t){const r=this.baseUrl;let o,s=e;const n=this.resolveHook;if(n){for(let e=0;e<n.length;e++){const t=(0,n[e])(s,{parentUrl:r});let i;if((t||null===t)&&(i=isResponseAPromise(t)?await t:t),null!==i){if("string"==typeof i){if(resolveIfNotPlainOrUrl(i,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);s=i;continue}if(o=i&&i.url&&(resolveIfNotPlainOrUrl(i.url,r)||i.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(s!==e){if(!o&&this.namedDefineRegistry.has(s))return s;e=s}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;if(this.resolver){if(o=this.resolver.resolve(t,r),this.namedDefineRegistry.has(t)&&this.namedDefineRegistry.get(t).defined){const e=this.moduleRegistry.get(o);if(!e||!e.aliases.has(t))return t}}else o=t}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r,o){const s=this.namedDefineRegistry.get(e);if(s&&s.defined)return void(this.lastDefine=s);const n={name:e,dependencies:t,exporter:r,signatures:o,defined:!0};s&&s.external&&s.external.resolveExternal(n),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,n),this.lastDefine=n,o.hashes&&Object.entries(o.hashes).forEach((([e,t])=>{this.checkModuleSignature(e,t)}))}registerExternalModules(e){const t=[];if(e.map((e=>{if(this.namedDefineRegistry.has(e))t.push(e);else{let t,r;const o=new Promise(((o,s)=>{t=o,r=setTimeout((()=>{s(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),s={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,s)}})),t.length)throw new LoaderError(MODULE_ALREADY_LOADED,[t.join(", ")])}checkModuleSignature(e,t){const r=this.namedDefineRegistry.get(e);if(!r){const r={name:e,signatures:{ownHash:t},defined:!1};return void this.namedDefineRegistry.set(e,r)}const o=r.signatures?r.signatures.ownHash:void 0;if(o&&t!==o){const r=this.handleStaleModuleHook;r?evaluateHandleStaleModuleHooks(r,{name:e,oldHash:o,newHash:t}):hasConsole&&console.warn(`stale module detected ${e}, current sig:${o}, new sig:${t}`)}}setImportResolver(e){this.resolver=e}getModuleRecord(e,t){let r=this.moduleRegistry.get(e);if(r)return r.aliases.has(t)||r.aliases.add(t),r;const o=this.getModuleDef(e,t),s=o.then((e=>{const t=e.dependencies.map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)}));return r={id:e,aliases:new Set([t]),module:Object.create(null),dependencyRecords:s,instantiation:o,evaluated:!1,evaluationPromise:null},this.moduleRegistry.set(e,r),r}async getModuleDependencyRecord(e){const t=await this.resolve(e);return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return await this.instantiateAll(e,{}),this.evaluateModule(e,{})}async instantiateAll(e,t){if(!t[e.id]){t[e.id]=!0;const r=await e.dependencyRecords;if(r)for(let e=0;e<r.length;e++){const o=r[e];await this.instantiateAll(o,t)}}}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:s}=await e.instantiation,n={},i=await Promise.all(s.map((async e=>{if("exports"===e)return n;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])})));if(e.evaluated)return e.module;let a=o(...i);void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(n)&&Object.defineProperty(n,"__useDefault",{value:!0});const l=a||n;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const s=this.baseUrl,n=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:n}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,s),n=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===n)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(n&&null!==n)return evaluateLoadHookResponse(n,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:n}),o})).catch((e=>{throw this.profiler.logOperationStart({id:MODULE_ERROR,specifier:n}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t])}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}}function getMatch(e,t){if(t[e])return e;let r=e.length;do{const o=e.slice(0,r+1);if(o in t)return o}while(-1!==(r=e.lastIndexOf("/",r-1)))}function targetWarning(e,t,r){hasConsole&&console.warn("Package target "+r+", resolving target '"+t+"' for "+e)}function applyPackages(e,t,r){const o=getMatch(e,t);if(o){const r=t[o];if(null===r)return;if(!(e.length>o.length&&"/"!==r[r.length-1])){return e.length>o.length&&"/"===r[r.length-1]&&r.lastIndexOf(o)===r.length-o.length?r.substring(0,r.lastIndexOf(o))+encodeURIComponent(e):r+e.slice(o.length)}targetWarning(o,r,"should have a trailing '/'")}else if(r&&!isUrl(e))return r+encodeURIComponent(e)}function resolveImportMapEntry(e,t,r){e.scopes||(e.scopes={}),e.imports||(e.imports={});const o=e.scopes;let s=r&&getMatch(r,o);for(;s;){const e=applyPackages(t,o[s]);if(e)return e;s=getMatch(s.slice(0,s.lastIndexOf("/")),o)}return applyPackages(t,e.imports,e.default)||isUrl(t)&&t||void 0}function resolveAndComposePackages(e,t,r,o,s){for(const n in e){const i=resolveIfNotPlainOrUrl(n,r)||n,a=e[n];if("string"!=typeof a)continue;const l=resolveImportMapEntry(o,resolveIfNotPlainOrUrl(a,r)||a,s);l?t[i]=l:targetWarning(n,a,"bare specifier did not resolve")}}function resolveAndComposeImportMap(e,t,r={imports:{},scopes:{}}){const o={imports:Object.assign({},r.imports),scopes:Object.assign({},r.scopes),default:e.default};if(e.imports&&resolveAndComposePackages(e.imports,o.imports,t,r),e.scopes)for(const s in e.scopes){const n=resolveUrl(s,t);resolveAndComposePackages(e.scopes[s],o.scopes[n]||(o.scopes[n]={}),t,r,n)}return e.default&&(o.default=resolveIfNotPlainOrUrl(e.default,t)),o}class ImportMapResolver{constructor(e){this.importMap=e}resolve(e,t){return resolveImportMapEntry(this.importMap,e,t)}}const IMPORTMAP_SCRIPT_TYPE="lwr-importmap";function iterateDocumentImportMaps(e,t){const r=document.querySelectorAll(`script[type="${IMPORTMAP_SCRIPT_TYPE}"]`+t),o=Array.from(r).filter((e=>!e.src||(hasConsole&&console.warn("LWR does not support import maps from script src"),!1)));Array.prototype.forEach.call(o,e)}async function getImportMapFromScript(e){return Promise.resolve(e.innerHTML)}async function evaluateImportMaps(e){let t={imports:{},scopes:{}},r=Promise.resolve(t);if(hasDocument){if(e||(e=getBaseUrl()),!e)throw new LoaderError(NO_BASE_URL);iterateDocumentImportMaps((o=>{r=r.then((()=>getImportMapFromScript(o))).then((e=>{try{return JSON.parse(e)}catch(e){throw new LoaderError(BAD_IMPORT_MAP)}})).then((r=>(t=resolveAndComposeImportMap(r,o.src||e,t),t)))}),"")}return r}class Loader{constructor(e){let t=(e=e||{}).baseUrl,r=e.profiler;if(t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);this.baseUrl=t,r||(r={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry({baseUrl:t,profiler:r}),this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata})}define(e,t,r,o){invariant("string"==typeof e,MISSING_NAME);let s=r,n=t,i=o;"function"==typeof n&&(s=t,n=[],i=r),i=i||{},invariant(Array.isArray(n),INVALID_DEPS),this.registry.define(e,n,s,i)}async load(e,t){return this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e){let t;if(t=e?resolveAndComposeImportMap(e,this.baseUrl,this.parentImportMap):await evaluateImportMaps(this.baseUrl),this.parentImportMap=t,this.parentImportMap){const e=new ImportMapResolver(this.parentImportMap);this.registry.setImportResolver(e)}}registerExternalModules(e){this.registry.registerExternalModules(e)}}exports.Loader=Loader,Object.defineProperty(exports,"__esModule",{value:!0})}));
|
|
@@ -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 Legacy Module Loader Shim v0.7.0-alpha.
|
|
7
|
+
/* LWR Legacy Module Loader Shim v0.7.0-alpha.2 */
|
|
8
8
|
(function () {
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
// Parse configuration
|
|
143
143
|
this.global = global;
|
|
144
144
|
this.config = global.LWR;
|
|
145
|
-
this.loaderModule = 'lwr/loaderLegacy/v/0_7_0-
|
|
145
|
+
this.loaderModule = 'lwr/loaderLegacy/v/0_7_0-alpha_2';
|
|
146
146
|
// Set up error handler
|
|
147
147
|
this.errorHandler = this.config.onError;
|
|
148
148
|
// Set up the temporary LWR.define function and customInit hook
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
const exporter = (exports) => {
|
|
244
244
|
Object.assign(exports, { logOperationStart, logOperationEnd });
|
|
245
245
|
};
|
|
246
|
-
loader.define('lwr/profiler/v/0_7_0-
|
|
246
|
+
loader.define('lwr/profiler/v/0_7_0-alpha_2', ['exports'], exporter, {});
|
|
247
247
|
}
|
|
248
248
|
// Set up the application globals, import map, root custom element...
|
|
249
249
|
mountApp(loader) {
|
|
@@ -302,8 +302,8 @@
|
|
|
302
302
|
// The loader module is ALWAYS required
|
|
303
303
|
const GLOBAL = globalThis;
|
|
304
304
|
GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
|
|
305
|
-
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_7_0-
|
|
306
|
-
GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_7_0-
|
|
305
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_7_0-alpha_2') < 0) {
|
|
306
|
+
GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_7_0-alpha_2');
|
|
307
307
|
}
|
|
308
308
|
new LoaderShim(GLOBAL);
|
|
309
309
|
|
|
@@ -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.7.0-alpha.
|
|
7
|
+
/* LWR Module Loader Shim v0.7.0-alpha.2 */
|
|
8
8
|
(function () {
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
// Parse configuration
|
|
141
141
|
this.global = global;
|
|
142
142
|
this.config = global.LWR;
|
|
143
|
-
this.loaderSpecifier = 'lwr/loader/v/0_7_0-
|
|
143
|
+
this.loaderSpecifier = 'lwr/loader/v/0_7_0-alpha_2';
|
|
144
144
|
// Set up error handler
|
|
145
145
|
this.errorHandler = this.config.onError;
|
|
146
146
|
// Set up the temporary LWR.define function and customInit hook
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
const exporter = (exports) => {
|
|
243
243
|
Object.assign(exports, { logOperationStart, logOperationEnd });
|
|
244
244
|
};
|
|
245
|
-
loader.define('lwr/profiler/v/0_7_0-
|
|
245
|
+
loader.define('lwr/profiler/v/0_7_0-alpha_2', ['exports'], exporter);
|
|
246
246
|
}
|
|
247
247
|
// Set up the application globals, import map, root custom element...
|
|
248
248
|
mountApp(loader) {
|
|
@@ -302,14 +302,14 @@
|
|
|
302
302
|
// The loader module is ALWAYS required
|
|
303
303
|
const GLOBAL = globalThis;
|
|
304
304
|
GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
|
|
305
|
-
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_7_0-
|
|
306
|
-
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_7_0-
|
|
305
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_7_0-alpha_2') < 0) {
|
|
306
|
+
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_7_0-alpha_2');
|
|
307
307
|
}
|
|
308
308
|
new LoaderShim(GLOBAL);
|
|
309
309
|
|
|
310
310
|
}());
|
|
311
311
|
|
|
312
|
-
LWR.define('lwr/loader/v/0_7_0-
|
|
312
|
+
LWR.define('lwr/loader/v/0_7_0-alpha_2', ['exports'], function (exports) { 'use strict';
|
|
313
313
|
|
|
314
314
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
315
315
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -633,23 +633,25 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
633
633
|
? this.config.endpoints.uris.mapping
|
|
634
634
|
: undefined;
|
|
635
635
|
}
|
|
636
|
-
|
|
637
|
-
const modifiers = this.config.endpoints ? this.config.endpoints.modifiers :
|
|
638
|
-
|
|
636
|
+
getQueryParams(importer) {
|
|
637
|
+
const modifiers = this.config.endpoints ? this.config.endpoints.modifiers : {};
|
|
638
|
+
const params = importer ? Object.assign({ importer }, modifiers) : Object.assign({}, modifiers);
|
|
639
|
+
const keys = Object.keys(params);
|
|
640
|
+
if (keys.length < 1) {
|
|
639
641
|
// No modifiers return an empty string to append to the URL
|
|
640
642
|
return '';
|
|
641
643
|
}
|
|
642
644
|
else {
|
|
643
|
-
const qs =
|
|
644
|
-
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(
|
|
645
|
+
const qs = keys
|
|
646
|
+
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
|
|
645
647
|
.join('&');
|
|
646
648
|
return `?${qs}`;
|
|
647
649
|
}
|
|
648
650
|
}
|
|
649
|
-
buildMappingUrl(specifier) {
|
|
651
|
+
buildMappingUrl(specifier, importer) {
|
|
650
652
|
const mappingEndpoint = this.getMappingEndpoint();
|
|
651
653
|
const specifiers = encodeURIComponent(specifier);
|
|
652
|
-
const modifiers = this.
|
|
654
|
+
const modifiers = this.getQueryParams(importer);
|
|
653
655
|
return `${mappingEndpoint}${specifiers}${modifiers}`;
|
|
654
656
|
}
|
|
655
657
|
getBaseUrl() {
|
|
@@ -691,14 +693,28 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
691
693
|
});
|
|
692
694
|
}
|
|
693
695
|
}
|
|
696
|
+
getImporterSpecifier(specifier, importer) {
|
|
697
|
+
return `${specifier}?importer=${encodeURIComponent(importer)}`;
|
|
698
|
+
}
|
|
694
699
|
// Get URL from the local cache or return undefiend
|
|
695
|
-
getURI(specifier) {
|
|
696
|
-
|
|
697
|
-
|
|
700
|
+
getURI(specifier, importer) {
|
|
701
|
+
// Check if we have the raw specifier or with the importer in the cache
|
|
702
|
+
let cachedSpecifier = undefined;
|
|
703
|
+
if (this.importURICache.has(specifier)) {
|
|
704
|
+
cachedSpecifier = specifier;
|
|
705
|
+
}
|
|
706
|
+
else if (importer) {
|
|
707
|
+
const importerSpecifier = this.getImporterSpecifier(specifier, importer);
|
|
708
|
+
if (this.importURICache.has(importerSpecifier)) {
|
|
709
|
+
cachedSpecifier = importerSpecifier;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return cachedSpecifier
|
|
713
|
+
? resolveUrl(this.importURICache.get(cachedSpecifier).uri, this.getBaseUrl())
|
|
698
714
|
: undefined;
|
|
699
715
|
}
|
|
700
|
-
resolveLocal(specifier) {
|
|
701
|
-
const uri = this.getURI(specifier);
|
|
716
|
+
resolveLocal(specifier, importer) {
|
|
717
|
+
const uri = this.getURI(specifier, importer);
|
|
702
718
|
if (uri) {
|
|
703
719
|
return uri;
|
|
704
720
|
}
|
|
@@ -717,8 +733,8 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
717
733
|
* @param specifier
|
|
718
734
|
* @returns module URI
|
|
719
735
|
*/
|
|
720
|
-
async resolve(specifier) {
|
|
721
|
-
let uri = this.getURI(specifier);
|
|
736
|
+
async resolve(specifier, importer) {
|
|
737
|
+
let uri = this.getURI(specifier, importer);
|
|
722
738
|
if (uri) {
|
|
723
739
|
return uri;
|
|
724
740
|
}
|
|
@@ -726,32 +742,33 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
726
742
|
return specifier;
|
|
727
743
|
}
|
|
728
744
|
else {
|
|
729
|
-
const
|
|
745
|
+
const pendingURICacheKey = importer ? this.getImporterSpecifier(specifier, importer) : specifier;
|
|
746
|
+
const pending = this.pendingURICache.get(pendingURICacheKey);
|
|
730
747
|
if (pending) {
|
|
731
748
|
return pending;
|
|
732
749
|
}
|
|
733
|
-
this.config.profiler.logOperationStart({ id: MAPPINGS_FETCH,
|
|
750
|
+
this.config.profiler.logOperationStart({ id: MAPPINGS_FETCH, pendingURICacheKey });
|
|
734
751
|
const fetchMappingService = this.hasMappingHooks()
|
|
735
752
|
? this.evaluateMappingHooks
|
|
736
753
|
: this.fetchNewMappings;
|
|
737
754
|
const promise = fetchMappingService
|
|
738
|
-
.bind(this)(specifier)
|
|
755
|
+
.bind(this)(specifier, importer)
|
|
739
756
|
.then((importMetadata) => {
|
|
740
757
|
if (!importMetadata || !importMetadata.imports) {
|
|
741
|
-
throw new LoaderError(UNRESOLVED, [
|
|
758
|
+
throw new LoaderError(UNRESOLVED, [pendingURICacheKey]);
|
|
742
759
|
}
|
|
743
760
|
this.registerImportMappings(importMetadata, [specifier]);
|
|
744
|
-
uri = this.getURI(specifier);
|
|
761
|
+
uri = this.getURI(specifier, importer);
|
|
745
762
|
if (!uri) {
|
|
746
|
-
throw new LoaderError(UNRESOLVED, [
|
|
763
|
+
throw new LoaderError(UNRESOLVED, [pendingURICacheKey]);
|
|
747
764
|
}
|
|
748
|
-
this.config.profiler.logOperationEnd({ id: MAPPINGS_FETCH,
|
|
765
|
+
this.config.profiler.logOperationEnd({ id: MAPPINGS_FETCH, pendingURICacheKey });
|
|
749
766
|
return uri;
|
|
750
767
|
})
|
|
751
768
|
.finally(() => {
|
|
752
|
-
this.pendingURICache.delete(
|
|
769
|
+
this.pendingURICache.delete(pendingURICacheKey);
|
|
753
770
|
});
|
|
754
|
-
this.pendingURICache.set(
|
|
771
|
+
this.pendingURICache.set(pendingURICacheKey, promise);
|
|
755
772
|
return promise;
|
|
756
773
|
}
|
|
757
774
|
}
|
|
@@ -763,7 +780,7 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
763
780
|
* @param specifier Request module identifier
|
|
764
781
|
* @returns Import Metadata from the module root
|
|
765
782
|
*/
|
|
766
|
-
async evaluateMappingHooks(specifier) {
|
|
783
|
+
async evaluateMappingHooks(specifier, importer) {
|
|
767
784
|
// Check with any registered loadMappingHooks
|
|
768
785
|
const loadMappingHooks = this.loadMappingHooks;
|
|
769
786
|
if (loadMappingHooks.length) {
|
|
@@ -779,15 +796,15 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
779
796
|
}
|
|
780
797
|
}
|
|
781
798
|
// If we still do not have a match call the mapping service
|
|
782
|
-
return this.fetchNewMappings(specifier);
|
|
799
|
+
return this.fetchNewMappings(specifier, importer);
|
|
783
800
|
}
|
|
784
|
-
async fetchNewMappings(specifier) {
|
|
801
|
+
async fetchNewMappings(specifier, importer) {
|
|
785
802
|
if (typeof globalThis.fetch !== 'function') {
|
|
786
803
|
throw new LoaderError(UNRESOLVED, [specifier]);
|
|
787
804
|
}
|
|
788
805
|
// TODO For module invalidation with bundles it is recommended we have to send back all loaded root specified
|
|
789
806
|
// to ensure we detect all conflicts.
|
|
790
|
-
const uri = resolveUrl(this.buildMappingUrl(specifier), this.getBaseUrl());
|
|
807
|
+
const uri = resolveUrl(this.buildMappingUrl(specifier, importer), this.getBaseUrl());
|
|
791
808
|
return globalThis.fetch(uri).then((res) => {
|
|
792
809
|
if (!res.ok) {
|
|
793
810
|
this.config.profiler.logOperationStart({ id: MAPPINGS_ERROR, specifier });
|
|
@@ -1003,7 +1020,7 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
1003
1020
|
if (this.moduleRegistry.has(resolvedOrPlain)) {
|
|
1004
1021
|
return resolvedOrPlain;
|
|
1005
1022
|
}
|
|
1006
|
-
const resolvedUrl = this.resolver.resolveLocal(resolvedOrPlain);
|
|
1023
|
+
const resolvedUrl = this.resolver.resolveLocal(resolvedOrPlain, importer);
|
|
1007
1024
|
if (resolvedUrl) {
|
|
1008
1025
|
// return the plain id if it is already defined && the resolvedUrl is NOT already in the module registry
|
|
1009
1026
|
if (this.namedDefineRegistry.has(resolvedOrPlain) &&
|
|
@@ -1019,7 +1036,7 @@ LWR.define('lwr/loader/v/0_7_0-alpha_1', ['exports'], function (exports) { 'use
|
|
|
1019
1036
|
return resolvedOrPlain;
|
|
1020
1037
|
}
|
|
1021
1038
|
try {
|
|
1022
|
-
resolved = await this.resolver.resolve(resolvedOrPlain);
|
|
1039
|
+
resolved = await this.resolver.resolve(resolvedOrPlain, importer);
|
|
1023
1040
|
}
|
|
1024
1041
|
catch (e) {
|
|
1025
1042
|
// defer to error handling below for unresolved
|
|
@@ -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 Module Loader Shim v0.7.0-alpha.
|
|
8
|
-
!function(){"use strict";var e;let t;function r(e){t=e}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(e||(e={}));const o=globalThis.performance,i=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n({id:r,specifier:n}){t?t({id:r,phase:e.Start,specifier:n}):i&&o.mark(r+(n?`.${n}`:""))}function s({id:r,specifier:n}){if(t)t({id:r,phase:e.End,specifier:n});else if(i){const e=n?`.${n}`:"",t=r+e,i=`${r}.duration${e}`;o.measure(i,t),o.clearMarks(t),o.clearMeasures(i)}}function a(e,t,o,i){const{autoBoot:n,customInit:s}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(n,s),s){s({initializeApp:t,define:o,onBootstrapError:i,attachDispatcher:r},e)}}const l="function"==typeof setTimeout,d="undefined"!=typeof console;const c=globalThis;c.LWR.requiredModules=c.LWR.requiredModules||[],c.LWR.requiredModules.indexOf("lwr/loader/v/0_7_0-alpha_1")<0&&c.LWR.requiredModules.push("lwr/loader/v/0_7_0-alpha_1"),new class{constructor(e){this.defineCache={},this.orderedDefs=[],l&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderSpecifier="lwr/loader/v/0_7_0-alpha_1",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{a(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(l&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&this.initApp()}initApp(){try{const e={endpoints:this.config.endpoints,baseUrl:this.config.baseUrl,profiler:{logOperationStart:n,logOperationEnd:s},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const i={};t[2].call(null,i);const{Loader:n}=i,s=new n(r);return o&&o.length&&s.registerExternalModules(o),s.define(e,["exports"],(e=>{Object.assign(e,{define:s.define.bind(s),load:s.load.bind(s),services:s.services})})),s}(this.loaderSpecifier,this.defineCache[this.loaderSpecifier],e,this.config.preloadModules);this.createProfilerModule(t),this.mountApp(t)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e.define("lwr/profiler/v/0_7_0-alpha_1",["exports"],(e=>{Object.assign(e,{logOperationStart:n,logOperationEnd:s})}))}mountApp(e){const{bootstrapModule:t,rootComponent:r,rootComponents:o,endpoints:i,imports:n,index:s}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:o,endpoints:i,imports:n||{},index:s||{}}),this.orderedDefs.forEach((t=>{t!==this.loaderSpecifier&&e.define(...this.defineCache[t])}));const{disableInitDefer:a}=this.config;e.registerImportMappings({imports:n,index:s},[t,r]).then((()=>{if(!a)return this.waitForDOMContentLoaded()})).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r} could not be loaded: ${e}`))}))}enterErrorState(e){n({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):d&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),3e5)}}(c)}(),LWR.define("lwr/loader/v/0_7_0-alpha_1",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"}),MODULE_ALREADY_LOADED=Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"}),FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"});Object.freeze({code:3011,level:0,message:"import map is not valid"});const hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let s=-1;for(let e=0;e<i.length;e++)-1!==s?"/"===i[e]&&(n.push(i.slice(s,e+1)),s=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:s=e:(n.pop(),e+=2):s=e;return-1!==s&&n.push(i.slice(s)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;class ImportMetadataResolver{constructor(e,t){this.importURICache=new Map,this.pendingURICache=new Map,this.loadMappingHooks=[],this.config=e,this.invalidationCallback=t}addLoadMappingHook(e){this.loadMappingHooks.push(e)}getMappingEndpoint(){return this.config.endpoints&&this.config.endpoints.uris?this.config.endpoints.uris.mapping:void 0}getModifiersAsUrlParams(){const e=this.config.endpoints?this.config.endpoints.modifiers:void 0;if(e){return`?${Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}`}return""}buildMappingUrl(e){return`${this.getMappingEndpoint()}${encodeURIComponent(e)}${this.getModifiersAsUrlParams()}`}getBaseUrl(){return this.config.baseUrl}registerImportMappings(e,t){if(!t||0===t.length){const r=e?JSON.stringify(e):"undefined";throw new LoaderError(BAD_IMPORT_METADATA,[r,t?"[]":"undefined"])}if(!e)throw new LoaderError(BAD_IMPORT_METADATA,["undefined",JSON.stringify(t)]);if(!e.imports||0===Object.keys(e.imports).length)throw new LoaderError(BAD_IMPORT_METADATA,[JSON.stringify(e),JSON.stringify(t)]);const r=e.index||{};for(const[o,i]of Object.entries(e.imports))i.forEach((e=>{const i=r[e],n=this.importURICache.get(e);if(n){const t=i||o,r=n.identity||n.uri;r!==t&&this.invalidationCallback({name:e,oldUrl:r,newUrl:t})}else this.saveImportURIRecord(e,o,i,t.includes(e))}))}getURI(e){return this.importURICache.has(e)?resolveUrl(this.importURICache.get(e).uri,this.getBaseUrl()):void 0}resolveLocal(e){const t=this.getURI(e);return t||(isUrl(e)||e.startsWith("/")?e:void 0)}async resolve(e){let t=this.getURI(e);if(t)return t;if(isUrl(e)||e.startsWith("/"))return e;{const r=this.pendingURICache.get(e);if(r)return r;this.config.profiler.logOperationStart({id:MAPPINGS_FETCH,specifier:e});const o=(this.hasMappingHooks()?this.evaluateMappingHooks:this.fetchNewMappings).bind(this)(e).then((r=>{if(!r||!r.imports)throw new LoaderError(UNRESOLVED,[e]);if(this.registerImportMappings(r,[e]),t=this.getURI(e),!t)throw new LoaderError(UNRESOLVED,[e]);return this.config.profiler.logOperationEnd({id:MAPPINGS_FETCH,specifier:e}),t})).finally((()=>{this.pendingURICache.delete(e)}));return this.pendingURICache.set(e,o),o}}hasMappingHooks(){return this.loadMappingHooks.length>0}async evaluateMappingHooks(e){const t=this.loadMappingHooks;if(t.length){const r=Array.from(this.importURICache.keys());for(let o=0;o<t.length;o++){const i=t[o],n=await i(e,{knownModules:r});if(n||void 0===n)return n}}return this.fetchNewMappings(e)}async fetchNewMappings(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e)).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=3e5;let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(code)}catch(e){throw new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0})).finally((()=>{}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const i=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(i)}))})):t}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");class ModuleRegistry{constructor(e){this.namedDefineRegistry=new Map,this.moduleRegistry=new Map,this.profiler=e.profiler,this.resolver=new ImportMetadataResolver(e,this.importMetadataInvalidationCallback.bind(this))}async load(e,t){const r=await this.resolve(e,t),o=this.getModuleRecord(r,e);return o.evaluated?o.module:(o.evaluationPromise||(o.evaluationPromise=this.topLevelEvaluation(o)),o.evaluationPromise)}async resolve(e,t){const r=this.resolver.getBaseUrl();let o,i=e;const n=this.resolveHook;if(n){for(let e=0;e<n.length;e++){const t=(0,n[e])(i,{parentUrl:r});let s;if((t||null===t)&&(s=isResponseAPromise(t)?await t:t),null!==s){if("string"==typeof s){if(resolveIfNotPlainOrUrl(s,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);i=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(i!==e){if(!o&&this.namedDefineRegistry.has(i))return i;e=i}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;const i=this.resolver.resolveLocal(t);if(i){if(this.namedDefineRegistry.has(t)&&this.namedDefineRegistry.get(t).defined){const e=this.moduleRegistry.get(i);if(!e||!e.aliases.has(t))return t}return i}if(this.namedDefineRegistry.has(t))return t;try{o=await this.resolver.resolve(t)}catch(e){}}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r){const o=this.namedDefineRegistry.get(e);if(o&&o.defined)return void(this.lastDefine=o);const i={name:e,dependencies:t,exporter:r,defined:!0};o&&o.external&&o.external.resolveExternal(i),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,i),this.lastDefine=i}registerExternalModules(e){const t=[];if(e.map((e=>{if(this.namedDefineRegistry.has(e))t.push(e);else{let t,r;const o=new Promise(((o,i)=>{t=o,r=setTimeout((()=>{i(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),i={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,i)}})),t.length)throw new LoaderError(MODULE_ALREADY_LOADED,[t.join(", ")])}getImportMetadataResolver(){return this.resolver}getModuleRecord(e,t){let r=this.moduleRegistry.get(e);if(r)return r.aliases.has(t)||r.aliases.add(t),r;const o=this.getModuleDef(e,t),i=o.then((e=>{const t=e.dependencies.map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)}));return r={id:e,aliases:new Set([t]),module:Object.create(null),dependencyRecords:i,instantiation:o,evaluated:!1,evaluationPromise:null},this.moduleRegistry.set(e,r),r}async getModuleDependencyRecord(e){const t=await this.resolve(e);return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return await this.instantiateAll(e,{}),this.evaluateModule(e,{})}async instantiateAll(e,t){if(!t[e.id]){t[e.id]=!0;const r=await e.dependencyRecords;if(r)for(let e=0;e<r.length;e++){const o=r[e];await this.instantiateAll(o,t)}}}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:i}=await e.instantiation,n={},s=await Promise.all(i.map((async e=>{if("exports"===e)return n;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])})));if(e.evaluated)return e.module;let a=o(...s);void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(n)&&Object.defineProperty(n,"__useDefault",{value:!0});const l=a||n;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const i=this.resolver.getBaseUrl(),n=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:n}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,i),n=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===n)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(n&&null!==n)return evaluateLoadHookResponse(n,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:n}),o})).catch((e=>{throw this.profiler.logOperationStart({id:MODULE_ERROR,specifier:n}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r,loadMapping:o}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t]),o&&this.resolver.addLoadMappingHook(o)}importMetadataInvalidationCallback({name:e,oldUrl:t,newUrl:r}){const o=this.handleStaleModuleHook;o?evaluateHandleStaleModuleHooks(o,{name:e,oldUrl:t,newUrl:r}):hasConsole&&console.warn(`stale module detected ${e}, current URL:${t}, new URL:${r}`)}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}}class Loader{constructor(e){let t=e.baseUrl;const r=e.endpoints?e.endpoints.uris.mapping:void 0;let o=e.profiler;if(!r)throw new LoaderError(NO_MAPPING_URL);if(e.endpoints.uris.mapping=r.replace(/\/?$/,"/"),t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);if(o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry(Object.freeze({endpoints:e.endpoints,baseUrl:t,profiler:o})),e.appMetadata&&!e.appMetadata.appId){const t=e.appMetadata.bootstrapModule.match(/@lwr-bootstrap\/(.+)\/v\/.+/),r=t&&t[1];e.appMetadata.appId=r}this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata})}define(e,t,r){invariant("string"==typeof e,MISSING_NAME);let o=r,i=t;"function"==typeof i&&(o=t,i=[]),invariant(Array.isArray(i),INVALID_DEPS),this.registry.define(e,i,o)}async load(e,t){return this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e,t){this.registry.getImportMetadataResolver().registerImportMappings(e,t)}registerExternalModules(e){this.registry.registerExternalModules(e)}}exports.Loader=Loader,Object.defineProperty(exports,"__esModule",{value:!0})}));
|
|
7
|
+
/* LWR Module Loader Shim v0.7.0-alpha.2 */
|
|
8
|
+
!function(){"use strict";var e;let t;function r(e){t=e}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(e||(e={}));const o=globalThis.performance,i=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n({id:r,specifier:n}){t?t({id:r,phase:e.Start,specifier:n}):i&&o.mark(r+(n?`.${n}`:""))}function s({id:r,specifier:n}){if(t)t({id:r,phase:e.End,specifier:n});else if(i){const e=n?`.${n}`:"",t=r+e,i=`${r}.duration${e}`;o.measure(i,t),o.clearMarks(t),o.clearMeasures(i)}}function a(e,t,o,i){const{autoBoot:n,customInit:s}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(n,s),s){s({initializeApp:t,define:o,onBootstrapError:i,attachDispatcher:r},e)}}const l="function"==typeof setTimeout,d="undefined"!=typeof console;const c=globalThis;c.LWR.requiredModules=c.LWR.requiredModules||[],c.LWR.requiredModules.indexOf("lwr/loader/v/0_7_0-alpha_2")<0&&c.LWR.requiredModules.push("lwr/loader/v/0_7_0-alpha_2"),new class{constructor(e){this.defineCache={},this.orderedDefs=[],l&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderSpecifier="lwr/loader/v/0_7_0-alpha_2",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{a(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(l&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&this.initApp()}initApp(){try{const e={endpoints:this.config.endpoints,baseUrl:this.config.baseUrl,profiler:{logOperationStart:n,logOperationEnd:s},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const i={};t[2].call(null,i);const{Loader:n}=i,s=new n(r);return o&&o.length&&s.registerExternalModules(o),s.define(e,["exports"],(e=>{Object.assign(e,{define:s.define.bind(s),load:s.load.bind(s),services:s.services})})),s}(this.loaderSpecifier,this.defineCache[this.loaderSpecifier],e,this.config.preloadModules);this.createProfilerModule(t),this.mountApp(t)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e.define("lwr/profiler/v/0_7_0-alpha_2",["exports"],(e=>{Object.assign(e,{logOperationStart:n,logOperationEnd:s})}))}mountApp(e){const{bootstrapModule:t,rootComponent:r,rootComponents:o,endpoints:i,imports:n,index:s}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:o,endpoints:i,imports:n||{},index:s||{}}),this.orderedDefs.forEach((t=>{t!==this.loaderSpecifier&&e.define(...this.defineCache[t])}));const{disableInitDefer:a}=this.config;e.registerImportMappings({imports:n,index:s},[t,r]).then((()=>{if(!a)return this.waitForDOMContentLoaded()})).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r} could not be loaded: ${e}`))}))}enterErrorState(e){n({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):d&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),3e5)}}(c)}(),LWR.define("lwr/loader/v/0_7_0-alpha_2",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"}),MODULE_ALREADY_LOADED=Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"}),FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"});Object.freeze({code:3011,level:0,message:"import map is not valid"});const hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let s=-1;for(let e=0;e<i.length;e++)-1!==s?"/"===i[e]&&(n.push(i.slice(s,e+1)),s=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:s=e:(n.pop(),e+=2):s=e;return-1!==s&&n.push(i.slice(s)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;class ImportMetadataResolver{constructor(e,t){this.importURICache=new Map,this.pendingURICache=new Map,this.loadMappingHooks=[],this.config=e,this.invalidationCallback=t}addLoadMappingHook(e){this.loadMappingHooks.push(e)}getMappingEndpoint(){return this.config.endpoints&&this.config.endpoints.uris?this.config.endpoints.uris.mapping:void 0}getQueryParams(e){const t=this.config.endpoints?this.config.endpoints.modifiers:{},r=e?Object.assign({importer:e},t):Object.assign({},t),o=Object.keys(r);if(o.length<1)return"";return`?${o.map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(r[e])}`)).join("&")}`}buildMappingUrl(e,t){return`${this.getMappingEndpoint()}${encodeURIComponent(e)}${this.getQueryParams(t)}`}getBaseUrl(){return this.config.baseUrl}registerImportMappings(e,t){if(!t||0===t.length){const r=e?JSON.stringify(e):"undefined";throw new LoaderError(BAD_IMPORT_METADATA,[r,t?"[]":"undefined"])}if(!e)throw new LoaderError(BAD_IMPORT_METADATA,["undefined",JSON.stringify(t)]);if(!e.imports||0===Object.keys(e.imports).length)throw new LoaderError(BAD_IMPORT_METADATA,[JSON.stringify(e),JSON.stringify(t)]);const r=e.index||{};for(const[o,i]of Object.entries(e.imports))i.forEach((e=>{const i=r[e],n=this.importURICache.get(e);if(n){const t=i||o,r=n.identity||n.uri;r!==t&&this.invalidationCallback({name:e,oldUrl:r,newUrl:t})}else this.saveImportURIRecord(e,o,i,t.includes(e))}))}getImporterSpecifier(e,t){return`${e}?importer=${encodeURIComponent(t)}`}getURI(e,t){let r;if(this.importURICache.has(e))r=e;else if(t){const o=this.getImporterSpecifier(e,t);this.importURICache.has(o)&&(r=o)}return r?resolveUrl(this.importURICache.get(r).uri,this.getBaseUrl()):void 0}resolveLocal(e,t){const r=this.getURI(e,t);return r||(isUrl(e)||e.startsWith("/")?e:void 0)}async resolve(e,t){let r=this.getURI(e,t);if(r)return r;if(isUrl(e)||e.startsWith("/"))return e;{const o=t?this.getImporterSpecifier(e,t):e,i=this.pendingURICache.get(o);if(i)return i;this.config.profiler.logOperationStart({id:MAPPINGS_FETCH,pendingURICacheKey:o});const n=(this.hasMappingHooks()?this.evaluateMappingHooks:this.fetchNewMappings).bind(this)(e,t).then((i=>{if(!i||!i.imports)throw new LoaderError(UNRESOLVED,[o]);if(this.registerImportMappings(i,[e]),r=this.getURI(e,t),!r)throw new LoaderError(UNRESOLVED,[o]);return this.config.profiler.logOperationEnd({id:MAPPINGS_FETCH,pendingURICacheKey:o}),r})).finally((()=>{this.pendingURICache.delete(o)}));return this.pendingURICache.set(o,n),n}}hasMappingHooks(){return this.loadMappingHooks.length>0}async evaluateMappingHooks(e,t){const r=this.loadMappingHooks;if(r.length){const t=Array.from(this.importURICache.keys());for(let o=0;o<r.length;o++){const i=r[o],n=await i(e,{knownModules:t});if(n||void 0===n)return n}}return this.fetchNewMappings(e,t)}async fetchNewMappings(e,t){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const r=resolveUrl(this.buildMappingUrl(e,t),this.getBaseUrl());return globalThis.fetch(r).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e)).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=3e5;let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(code)}catch(e){throw new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0})).finally((()=>{}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const i=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(i)}))})):t}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");class ModuleRegistry{constructor(e){this.namedDefineRegistry=new Map,this.moduleRegistry=new Map,this.profiler=e.profiler,this.resolver=new ImportMetadataResolver(e,this.importMetadataInvalidationCallback.bind(this))}async load(e,t){const r=await this.resolve(e,t),o=this.getModuleRecord(r,e);return o.evaluated?o.module:(o.evaluationPromise||(o.evaluationPromise=this.topLevelEvaluation(o)),o.evaluationPromise)}async resolve(e,t){const r=this.resolver.getBaseUrl();let o,i=e;const n=this.resolveHook;if(n){for(let e=0;e<n.length;e++){const t=(0,n[e])(i,{parentUrl:r});let s;if((t||null===t)&&(s=isResponseAPromise(t)?await t:t),null!==s){if("string"==typeof s){if(resolveIfNotPlainOrUrl(s,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);i=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(i!==e){if(!o&&this.namedDefineRegistry.has(i))return i;e=i}}if(!o){const i=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(i))return i;const n=this.resolver.resolveLocal(i,t);if(n){if(this.namedDefineRegistry.has(i)&&this.namedDefineRegistry.get(i).defined){const e=this.moduleRegistry.get(n);if(!e||!e.aliases.has(i))return i}return n}if(this.namedDefineRegistry.has(i))return i;try{o=await this.resolver.resolve(i,t)}catch(e){}}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r){const o=this.namedDefineRegistry.get(e);if(o&&o.defined)return void(this.lastDefine=o);const i={name:e,dependencies:t,exporter:r,defined:!0};o&&o.external&&o.external.resolveExternal(i),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,i),this.lastDefine=i}registerExternalModules(e){const t=[];if(e.map((e=>{if(this.namedDefineRegistry.has(e))t.push(e);else{let t,r;const o=new Promise(((o,i)=>{t=o,r=setTimeout((()=>{i(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),i={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,i)}})),t.length)throw new LoaderError(MODULE_ALREADY_LOADED,[t.join(", ")])}getImportMetadataResolver(){return this.resolver}getModuleRecord(e,t){let r=this.moduleRegistry.get(e);if(r)return r.aliases.has(t)||r.aliases.add(t),r;const o=this.getModuleDef(e,t),i=o.then((e=>{const t=e.dependencies.map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)}));return r={id:e,aliases:new Set([t]),module:Object.create(null),dependencyRecords:i,instantiation:o,evaluated:!1,evaluationPromise:null},this.moduleRegistry.set(e,r),r}async getModuleDependencyRecord(e){const t=await this.resolve(e);return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return await this.instantiateAll(e,{}),this.evaluateModule(e,{})}async instantiateAll(e,t){if(!t[e.id]){t[e.id]=!0;const r=await e.dependencyRecords;if(r)for(let e=0;e<r.length;e++){const o=r[e];await this.instantiateAll(o,t)}}}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:i}=await e.instantiation,n={},s=await Promise.all(i.map((async e=>{if("exports"===e)return n;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])})));if(e.evaluated)return e.module;let a=o(...s);void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(n)&&Object.defineProperty(n,"__useDefault",{value:!0});const l=a||n;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const i=this.resolver.getBaseUrl(),n=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:n}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,i),n=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===n)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(n&&null!==n)return evaluateLoadHookResponse(n,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:n}),o})).catch((e=>{throw this.profiler.logOperationStart({id:MODULE_ERROR,specifier:n}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r,loadMapping:o}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t]),o&&this.resolver.addLoadMappingHook(o)}importMetadataInvalidationCallback({name:e,oldUrl:t,newUrl:r}){const o=this.handleStaleModuleHook;o?evaluateHandleStaleModuleHooks(o,{name:e,oldUrl:t,newUrl:r}):hasConsole&&console.warn(`stale module detected ${e}, current URL:${t}, new URL:${r}`)}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}}class Loader{constructor(e){let t=e.baseUrl;const r=e.endpoints?e.endpoints.uris.mapping:void 0;let o=e.profiler;if(!r)throw new LoaderError(NO_MAPPING_URL);if(e.endpoints.uris.mapping=r.replace(/\/?$/,"/"),t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);if(o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry(Object.freeze({endpoints:e.endpoints,baseUrl:t,profiler:o})),e.appMetadata&&!e.appMetadata.appId){const t=e.appMetadata.bootstrapModule.match(/@lwr-bootstrap\/(.+)\/v\/.+/),r=t&&t[1];e.appMetadata.appId=r}this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata})}define(e,t,r){invariant("string"==typeof e,MISSING_NAME);let o=r,i=t;"function"==typeof i&&(o=t,i=[]),invariant(Array.isArray(i),INVALID_DEPS),this.registry.define(e,i,o)}async load(e,t){return this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e,t){this.registry.getImportMetadataResolver().registerImportMappings(e,t)}registerExternalModules(e){this.registry.registerExternalModules(e)}}exports.Loader=Loader,Object.defineProperty(exports,"__esModule",{value:!0})}));
|
|
@@ -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.7.0-alpha.
|
|
7
|
+
/* LWR Module Loader Shim v0.7.0-alpha.2 */
|
|
8
8
|
(function () {
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
// Parse configuration
|
|
141
141
|
this.global = global;
|
|
142
142
|
this.config = global.LWR;
|
|
143
|
-
this.loaderSpecifier = 'lwr/loader/v/0_7_0-
|
|
143
|
+
this.loaderSpecifier = 'lwr/loader/v/0_7_0-alpha_2';
|
|
144
144
|
// Set up error handler
|
|
145
145
|
this.errorHandler = this.config.onError;
|
|
146
146
|
// Set up the temporary LWR.define function and customInit hook
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
const exporter = (exports) => {
|
|
243
243
|
Object.assign(exports, { logOperationStart, logOperationEnd });
|
|
244
244
|
};
|
|
245
|
-
loader.define('lwr/profiler/v/0_7_0-
|
|
245
|
+
loader.define('lwr/profiler/v/0_7_0-alpha_2', ['exports'], exporter);
|
|
246
246
|
}
|
|
247
247
|
// Set up the application globals, import map, root custom element...
|
|
248
248
|
mountApp(loader) {
|
|
@@ -302,8 +302,8 @@
|
|
|
302
302
|
// The loader module is ALWAYS required
|
|
303
303
|
const GLOBAL = globalThis;
|
|
304
304
|
GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
|
|
305
|
-
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_7_0-
|
|
306
|
-
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_7_0-
|
|
305
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_7_0-alpha_2') < 0) {
|
|
306
|
+
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_7_0-alpha_2');
|
|
307
307
|
}
|
|
308
308
|
new LoaderShim(GLOBAL);
|
|
309
309
|
|
|
@@ -43,19 +43,21 @@ var ImportMetadataResolver = class {
|
|
|
43
43
|
getMappingEndpoint() {
|
|
44
44
|
return this.config.endpoints && this.config.endpoints.uris ? this.config.endpoints.uris.mapping : void 0;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
const modifiers = this.config.endpoints ? this.config.endpoints.modifiers :
|
|
48
|
-
|
|
46
|
+
getQueryParams(importer) {
|
|
47
|
+
const modifiers = this.config.endpoints ? this.config.endpoints.modifiers : {};
|
|
48
|
+
const params = importer ? {importer, ...modifiers} : {...modifiers};
|
|
49
|
+
const keys = Object.keys(params);
|
|
50
|
+
if (keys.length < 1) {
|
|
49
51
|
return "";
|
|
50
52
|
} else {
|
|
51
|
-
const qs =
|
|
53
|
+
const qs = keys.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
|
|
52
54
|
return `?${qs}`;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
buildMappingUrl(specifier) {
|
|
57
|
+
buildMappingUrl(specifier, importer) {
|
|
56
58
|
const mappingEndpoint = this.getMappingEndpoint();
|
|
57
59
|
const specifiers = encodeURIComponent(specifier);
|
|
58
|
-
const modifiers = this.
|
|
60
|
+
const modifiers = this.getQueryParams(importer);
|
|
59
61
|
return `${mappingEndpoint}${specifiers}${modifiers}`;
|
|
60
62
|
}
|
|
61
63
|
getBaseUrl() {
|
|
@@ -96,11 +98,23 @@ var ImportMetadataResolver = class {
|
|
|
96
98
|
});
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
+
getImporterSpecifier(specifier, importer) {
|
|
102
|
+
return `${specifier}?importer=${encodeURIComponent(importer)}`;
|
|
101
103
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
getURI(specifier, importer) {
|
|
105
|
+
let cachedSpecifier = void 0;
|
|
106
|
+
if (this.importURICache.has(specifier)) {
|
|
107
|
+
cachedSpecifier = specifier;
|
|
108
|
+
} else if (importer) {
|
|
109
|
+
const importerSpecifier = this.getImporterSpecifier(specifier, importer);
|
|
110
|
+
if (this.importURICache.has(importerSpecifier)) {
|
|
111
|
+
cachedSpecifier = importerSpecifier;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return cachedSpecifier ? (0, import_url.resolveUrl)(this.importURICache.get(cachedSpecifier).uri, this.getBaseUrl()) : void 0;
|
|
115
|
+
}
|
|
116
|
+
resolveLocal(specifier, importer) {
|
|
117
|
+
const uri = this.getURI(specifier, importer);
|
|
104
118
|
if (uri) {
|
|
105
119
|
return uri;
|
|
106
120
|
} else if ((0, import_url.isUrl)(specifier) || specifier.startsWith("/")) {
|
|
@@ -108,41 +122,42 @@ var ImportMetadataResolver = class {
|
|
|
108
122
|
}
|
|
109
123
|
return void 0;
|
|
110
124
|
}
|
|
111
|
-
async resolve(specifier) {
|
|
112
|
-
let uri = this.getURI(specifier);
|
|
125
|
+
async resolve(specifier, importer) {
|
|
126
|
+
let uri = this.getURI(specifier, importer);
|
|
113
127
|
if (uri) {
|
|
114
128
|
return uri;
|
|
115
129
|
} else if ((0, import_url.isUrl)(specifier) || specifier.startsWith("/")) {
|
|
116
130
|
return specifier;
|
|
117
131
|
} else {
|
|
118
|
-
const
|
|
132
|
+
const pendingURICacheKey = importer ? this.getImporterSpecifier(specifier, importer) : specifier;
|
|
133
|
+
const pending = this.pendingURICache.get(pendingURICacheKey);
|
|
119
134
|
if (pending) {
|
|
120
135
|
return pending;
|
|
121
136
|
}
|
|
122
|
-
this.config.profiler.logOperationStart({id: import_metrics.MAPPINGS_FETCH,
|
|
137
|
+
this.config.profiler.logOperationStart({id: import_metrics.MAPPINGS_FETCH, pendingURICacheKey});
|
|
123
138
|
const fetchMappingService = this.hasMappingHooks() ? this.evaluateMappingHooks : this.fetchNewMappings;
|
|
124
|
-
const promise = fetchMappingService.bind(this)(specifier).then((importMetadata) => {
|
|
139
|
+
const promise = fetchMappingService.bind(this)(specifier, importer).then((importMetadata) => {
|
|
125
140
|
if (!importMetadata || !importMetadata.imports) {
|
|
126
|
-
throw new import_messages.LoaderError(import_messages.UNRESOLVED, [
|
|
141
|
+
throw new import_messages.LoaderError(import_messages.UNRESOLVED, [pendingURICacheKey]);
|
|
127
142
|
}
|
|
128
143
|
this.registerImportMappings(importMetadata, [specifier]);
|
|
129
|
-
uri = this.getURI(specifier);
|
|
144
|
+
uri = this.getURI(specifier, importer);
|
|
130
145
|
if (!uri) {
|
|
131
|
-
throw new import_messages.LoaderError(import_messages.UNRESOLVED, [
|
|
146
|
+
throw new import_messages.LoaderError(import_messages.UNRESOLVED, [pendingURICacheKey]);
|
|
132
147
|
}
|
|
133
|
-
this.config.profiler.logOperationEnd({id: import_metrics.MAPPINGS_FETCH,
|
|
148
|
+
this.config.profiler.logOperationEnd({id: import_metrics.MAPPINGS_FETCH, pendingURICacheKey});
|
|
134
149
|
return uri;
|
|
135
150
|
}).finally(() => {
|
|
136
|
-
this.pendingURICache.delete(
|
|
151
|
+
this.pendingURICache.delete(pendingURICacheKey);
|
|
137
152
|
});
|
|
138
|
-
this.pendingURICache.set(
|
|
153
|
+
this.pendingURICache.set(pendingURICacheKey, promise);
|
|
139
154
|
return promise;
|
|
140
155
|
}
|
|
141
156
|
}
|
|
142
157
|
hasMappingHooks() {
|
|
143
158
|
return this.loadMappingHooks.length > 0;
|
|
144
159
|
}
|
|
145
|
-
async evaluateMappingHooks(specifier) {
|
|
160
|
+
async evaluateMappingHooks(specifier, importer) {
|
|
146
161
|
const loadMappingHooks = this.loadMappingHooks;
|
|
147
162
|
if (loadMappingHooks.length) {
|
|
148
163
|
const knownModules = Array.from(this.importURICache.keys());
|
|
@@ -154,13 +169,13 @@ var ImportMetadataResolver = class {
|
|
|
154
169
|
}
|
|
155
170
|
}
|
|
156
171
|
}
|
|
157
|
-
return this.fetchNewMappings(specifier);
|
|
172
|
+
return this.fetchNewMappings(specifier, importer);
|
|
158
173
|
}
|
|
159
|
-
async fetchNewMappings(specifier) {
|
|
174
|
+
async fetchNewMappings(specifier, importer) {
|
|
160
175
|
if (typeof globalThis.fetch !== "function") {
|
|
161
176
|
throw new import_messages.LoaderError(import_messages.UNRESOLVED, [specifier]);
|
|
162
177
|
}
|
|
163
|
-
const uri = (0, import_url.resolveUrl)(this.buildMappingUrl(specifier), this.getBaseUrl());
|
|
178
|
+
const uri = (0, import_url.resolveUrl)(this.buildMappingUrl(specifier, importer), this.getBaseUrl());
|
|
164
179
|
return globalThis.fetch(uri).then((res) => {
|
|
165
180
|
if (!res.ok) {
|
|
166
181
|
this.config.profiler.logOperationStart({id: import_metrics.MAPPINGS_ERROR, specifier});
|
|
@@ -95,7 +95,7 @@ var ModuleRegistry = class {
|
|
|
95
95
|
if (this.moduleRegistry.has(resolvedOrPlain)) {
|
|
96
96
|
return resolvedOrPlain;
|
|
97
97
|
}
|
|
98
|
-
const resolvedUrl = this.resolver.resolveLocal(resolvedOrPlain);
|
|
98
|
+
const resolvedUrl = this.resolver.resolveLocal(resolvedOrPlain, importer);
|
|
99
99
|
if (resolvedUrl) {
|
|
100
100
|
if (this.namedDefineRegistry.has(resolvedOrPlain) && this.namedDefineRegistry.get(resolvedOrPlain).defined) {
|
|
101
101
|
const record = this.moduleRegistry.get(resolvedUrl);
|
|
@@ -109,7 +109,7 @@ var ModuleRegistry = class {
|
|
|
109
109
|
return resolvedOrPlain;
|
|
110
110
|
}
|
|
111
111
|
try {
|
|
112
|
-
resolved = await this.resolver.resolve(resolvedOrPlain);
|
|
112
|
+
resolved = await this.resolver.resolve(resolvedOrPlain, importer);
|
|
113
113
|
} catch (e) {
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -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 ESM Module Loader v0.7.0-alpha.
|
|
7
|
+
/* LWR ESM Module Loader v0.7.0-alpha.2 */
|
|
8
8
|
/**
|
|
9
9
|
* Simplified version of the AMD Import Metadata Resolver.
|
|
10
10
|
* Just reads the ImportMetadata at construction time.
|
|
@@ -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 v0.7.0-alpha.
|
|
7
|
+
/* LWR Module Loader v0.7.0-alpha.2 */
|
|
8
8
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
function templateString(template, args) {
|
|
@@ -327,23 +327,25 @@ class ImportMetadataResolver {
|
|
|
327
327
|
? this.config.endpoints.uris.mapping
|
|
328
328
|
: undefined;
|
|
329
329
|
}
|
|
330
|
-
|
|
331
|
-
const modifiers = this.config.endpoints ? this.config.endpoints.modifiers :
|
|
332
|
-
|
|
330
|
+
getQueryParams(importer) {
|
|
331
|
+
const modifiers = this.config.endpoints ? this.config.endpoints.modifiers : {};
|
|
332
|
+
const params = importer ? Object.assign({ importer }, modifiers) : Object.assign({}, modifiers);
|
|
333
|
+
const keys = Object.keys(params);
|
|
334
|
+
if (keys.length < 1) {
|
|
333
335
|
// No modifiers return an empty string to append to the URL
|
|
334
336
|
return '';
|
|
335
337
|
}
|
|
336
338
|
else {
|
|
337
|
-
const qs =
|
|
338
|
-
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(
|
|
339
|
+
const qs = keys
|
|
340
|
+
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
|
|
339
341
|
.join('&');
|
|
340
342
|
return `?${qs}`;
|
|
341
343
|
}
|
|
342
344
|
}
|
|
343
|
-
buildMappingUrl(specifier) {
|
|
345
|
+
buildMappingUrl(specifier, importer) {
|
|
344
346
|
const mappingEndpoint = this.getMappingEndpoint();
|
|
345
347
|
const specifiers = encodeURIComponent(specifier);
|
|
346
|
-
const modifiers = this.
|
|
348
|
+
const modifiers = this.getQueryParams(importer);
|
|
347
349
|
return `${mappingEndpoint}${specifiers}${modifiers}`;
|
|
348
350
|
}
|
|
349
351
|
getBaseUrl() {
|
|
@@ -385,14 +387,28 @@ class ImportMetadataResolver {
|
|
|
385
387
|
});
|
|
386
388
|
}
|
|
387
389
|
}
|
|
390
|
+
getImporterSpecifier(specifier, importer) {
|
|
391
|
+
return `${specifier}?importer=${encodeURIComponent(importer)}`;
|
|
392
|
+
}
|
|
388
393
|
// Get URL from the local cache or return undefiend
|
|
389
|
-
getURI(specifier) {
|
|
390
|
-
|
|
391
|
-
|
|
394
|
+
getURI(specifier, importer) {
|
|
395
|
+
// Check if we have the raw specifier or with the importer in the cache
|
|
396
|
+
let cachedSpecifier = undefined;
|
|
397
|
+
if (this.importURICache.has(specifier)) {
|
|
398
|
+
cachedSpecifier = specifier;
|
|
399
|
+
}
|
|
400
|
+
else if (importer) {
|
|
401
|
+
const importerSpecifier = this.getImporterSpecifier(specifier, importer);
|
|
402
|
+
if (this.importURICache.has(importerSpecifier)) {
|
|
403
|
+
cachedSpecifier = importerSpecifier;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return cachedSpecifier
|
|
407
|
+
? resolveUrl(this.importURICache.get(cachedSpecifier).uri, this.getBaseUrl())
|
|
392
408
|
: undefined;
|
|
393
409
|
}
|
|
394
|
-
resolveLocal(specifier) {
|
|
395
|
-
const uri = this.getURI(specifier);
|
|
410
|
+
resolveLocal(specifier, importer) {
|
|
411
|
+
const uri = this.getURI(specifier, importer);
|
|
396
412
|
if (uri) {
|
|
397
413
|
return uri;
|
|
398
414
|
}
|
|
@@ -411,8 +427,8 @@ class ImportMetadataResolver {
|
|
|
411
427
|
* @param specifier
|
|
412
428
|
* @returns module URI
|
|
413
429
|
*/
|
|
414
|
-
async resolve(specifier) {
|
|
415
|
-
let uri = this.getURI(specifier);
|
|
430
|
+
async resolve(specifier, importer) {
|
|
431
|
+
let uri = this.getURI(specifier, importer);
|
|
416
432
|
if (uri) {
|
|
417
433
|
return uri;
|
|
418
434
|
}
|
|
@@ -420,32 +436,33 @@ class ImportMetadataResolver {
|
|
|
420
436
|
return specifier;
|
|
421
437
|
}
|
|
422
438
|
else {
|
|
423
|
-
const
|
|
439
|
+
const pendingURICacheKey = importer ? this.getImporterSpecifier(specifier, importer) : specifier;
|
|
440
|
+
const pending = this.pendingURICache.get(pendingURICacheKey);
|
|
424
441
|
if (pending) {
|
|
425
442
|
return pending;
|
|
426
443
|
}
|
|
427
|
-
this.config.profiler.logOperationStart({ id: MAPPINGS_FETCH,
|
|
444
|
+
this.config.profiler.logOperationStart({ id: MAPPINGS_FETCH, pendingURICacheKey });
|
|
428
445
|
const fetchMappingService = this.hasMappingHooks()
|
|
429
446
|
? this.evaluateMappingHooks
|
|
430
447
|
: this.fetchNewMappings;
|
|
431
448
|
const promise = fetchMappingService
|
|
432
|
-
.bind(this)(specifier)
|
|
449
|
+
.bind(this)(specifier, importer)
|
|
433
450
|
.then((importMetadata) => {
|
|
434
451
|
if (!importMetadata || !importMetadata.imports) {
|
|
435
|
-
throw new LoaderError(UNRESOLVED, [
|
|
452
|
+
throw new LoaderError(UNRESOLVED, [pendingURICacheKey]);
|
|
436
453
|
}
|
|
437
454
|
this.registerImportMappings(importMetadata, [specifier]);
|
|
438
|
-
uri = this.getURI(specifier);
|
|
455
|
+
uri = this.getURI(specifier, importer);
|
|
439
456
|
if (!uri) {
|
|
440
|
-
throw new LoaderError(UNRESOLVED, [
|
|
457
|
+
throw new LoaderError(UNRESOLVED, [pendingURICacheKey]);
|
|
441
458
|
}
|
|
442
|
-
this.config.profiler.logOperationEnd({ id: MAPPINGS_FETCH,
|
|
459
|
+
this.config.profiler.logOperationEnd({ id: MAPPINGS_FETCH, pendingURICacheKey });
|
|
443
460
|
return uri;
|
|
444
461
|
})
|
|
445
462
|
.finally(() => {
|
|
446
|
-
this.pendingURICache.delete(
|
|
463
|
+
this.pendingURICache.delete(pendingURICacheKey);
|
|
447
464
|
});
|
|
448
|
-
this.pendingURICache.set(
|
|
465
|
+
this.pendingURICache.set(pendingURICacheKey, promise);
|
|
449
466
|
return promise;
|
|
450
467
|
}
|
|
451
468
|
}
|
|
@@ -457,7 +474,7 @@ class ImportMetadataResolver {
|
|
|
457
474
|
* @param specifier Request module identifier
|
|
458
475
|
* @returns Import Metadata from the module root
|
|
459
476
|
*/
|
|
460
|
-
async evaluateMappingHooks(specifier) {
|
|
477
|
+
async evaluateMappingHooks(specifier, importer) {
|
|
461
478
|
// Check with any registered loadMappingHooks
|
|
462
479
|
const loadMappingHooks = this.loadMappingHooks;
|
|
463
480
|
if (loadMappingHooks.length) {
|
|
@@ -473,15 +490,15 @@ class ImportMetadataResolver {
|
|
|
473
490
|
}
|
|
474
491
|
}
|
|
475
492
|
// If we still do not have a match call the mapping service
|
|
476
|
-
return this.fetchNewMappings(specifier);
|
|
493
|
+
return this.fetchNewMappings(specifier, importer);
|
|
477
494
|
}
|
|
478
|
-
async fetchNewMappings(specifier) {
|
|
495
|
+
async fetchNewMappings(specifier, importer) {
|
|
479
496
|
if (typeof globalThis.fetch !== 'function') {
|
|
480
497
|
throw new LoaderError(UNRESOLVED, [specifier]);
|
|
481
498
|
}
|
|
482
499
|
// TODO For module invalidation with bundles it is recommended we have to send back all loaded root specified
|
|
483
500
|
// to ensure we detect all conflicts.
|
|
484
|
-
const uri = resolveUrl(this.buildMappingUrl(specifier), this.getBaseUrl());
|
|
501
|
+
const uri = resolveUrl(this.buildMappingUrl(specifier, importer), this.getBaseUrl());
|
|
485
502
|
return globalThis.fetch(uri).then((res) => {
|
|
486
503
|
if (!res.ok) {
|
|
487
504
|
this.config.profiler.logOperationStart({ id: MAPPINGS_ERROR, specifier });
|
|
@@ -697,7 +714,7 @@ class ModuleRegistry {
|
|
|
697
714
|
if (this.moduleRegistry.has(resolvedOrPlain)) {
|
|
698
715
|
return resolvedOrPlain;
|
|
699
716
|
}
|
|
700
|
-
const resolvedUrl = this.resolver.resolveLocal(resolvedOrPlain);
|
|
717
|
+
const resolvedUrl = this.resolver.resolveLocal(resolvedOrPlain, importer);
|
|
701
718
|
if (resolvedUrl) {
|
|
702
719
|
// return the plain id if it is already defined && the resolvedUrl is NOT already in the module registry
|
|
703
720
|
if (this.namedDefineRegistry.has(resolvedOrPlain) &&
|
|
@@ -713,7 +730,7 @@ class ModuleRegistry {
|
|
|
713
730
|
return resolvedOrPlain;
|
|
714
731
|
}
|
|
715
732
|
try {
|
|
716
|
-
resolved = await this.resolver.resolve(resolvedOrPlain);
|
|
733
|
+
resolved = await this.resolver.resolve(resolvedOrPlain, importer);
|
|
717
734
|
}
|
|
718
735
|
catch (e) {
|
|
719
736
|
// defer to error handling below for unresolved
|
|
@@ -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 Legacy Module Loader v0.7.0-alpha.
|
|
7
|
+
/* LWR Legacy Module Loader v0.7.0-alpha.2 */
|
|
8
8
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
function templateString(template, args) {
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.7.0-alpha.
|
|
8
|
+
"version": "0.7.0-alpha.2",
|
|
9
9
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"build": "yarn build:ts && yarn build:error-shim && yarn build:shim && yarn build:loader && yarn build:shim:bundle && yarn build:shim:bundle:minify"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@lwrjs/compiler": "0.7.0-alpha.
|
|
65
|
-
"@lwrjs/diagnostics": "0.7.0-alpha.
|
|
66
|
-
"@lwrjs/types": "0.7.0-alpha.
|
|
64
|
+
"@lwrjs/compiler": "0.7.0-alpha.2",
|
|
65
|
+
"@lwrjs/diagnostics": "0.7.0-alpha.2",
|
|
66
|
+
"@lwrjs/types": "0.7.0-alpha.2",
|
|
67
67
|
"rollup-plugin-terser": "^7.0.2"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@lwrjs/shared-utils": "0.7.0-alpha.
|
|
70
|
+
"@lwrjs/shared-utils": "0.7.0-alpha.2"
|
|
71
71
|
},
|
|
72
72
|
"lwc": {
|
|
73
73
|
"modules": [
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": ">=14.15.4 <17"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "fc3a13d1c5440833eb2ec17fbf0e294554bafa08"
|
|
88
88
|
}
|