@lwrjs/loader 0.9.0-alpha.3 → 0.9.0-alpha.30
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 +30 -32
- package/build/assets/prod/lwr-loader-shim-legacy.bundle.min.js +2 -2
- package/build/assets/prod/lwr-loader-shim-legacy.js +20 -19
- package/build/assets/prod/lwr-loader-shim.bundle.js +31 -32
- package/build/assets/prod/lwr-loader-shim.bundle.min.js +2 -2
- package/build/assets/prod/lwr-loader-shim.js +20 -19
- package/build/bundle/prod/lwr/esmLoader/esmLoader.js +1 -1
- package/build/cjs/index.cjs +1 -1
- package/build/cjs/modules/lwr/esmLoader/esmLoader.cjs +23 -19
- package/build/cjs/modules/lwr/loader/errors/messages.cjs +1 -1
- package/build/cjs/modules/lwr/loader/moduleRegistry/moduleRegistry.cjs +3 -7
- package/build/cjs/modules/lwr/loaderLegacy/moduleRegistry/moduleRegistry.cjs +3 -7
- package/build/index.js +1 -1
- package/build/modules/lwr/esmLoader/esmLoader.js +28 -24
- package/build/modules/lwr/loader/__tests__/utils/amd.js +2 -3
- package/build/modules/lwr/loader/loader.js +11 -13
- package/build/modules/lwr/loaderLegacy/__tests__/utils/amd.js +4 -5
- package/build/modules/lwr/loaderLegacy/loaderLegacy.js +10 -13
- package/package.json +10 -9
|
@@ -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.9.0-alpha.
|
|
7
|
+
/* LWR Legacy Module Loader v0.9.0-alpha.30 */
|
|
8
8
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
function templateString(template, args) {
|
|
@@ -402,6 +402,7 @@ function evaluateHandleStaleModuleHooks(handleStaleModuleHooks, hookArgs) {
|
|
|
402
402
|
|
|
403
403
|
// Bootstrap / shim
|
|
404
404
|
|
|
405
|
+
// Loader: modules
|
|
405
406
|
const LOADER_PREFIX = 'lwr.loader.';
|
|
406
407
|
const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
|
|
407
408
|
const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
|
|
@@ -548,12 +549,8 @@ class ModuleRegistry {
|
|
|
548
549
|
* @param modules - list of module identifiers
|
|
549
550
|
*/
|
|
550
551
|
registerExternalModules(modules) {
|
|
551
|
-
const alreadyRegistered = [];
|
|
552
552
|
modules.map((id) => {
|
|
553
|
-
if (this.namedDefineRegistry.has(id)) {
|
|
554
|
-
alreadyRegistered.push(id);
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
553
|
+
if (!this.namedDefineRegistry.has(id)) {
|
|
557
554
|
let resolveExternal;
|
|
558
555
|
let timer;
|
|
559
556
|
const moduleDefPromise = new Promise((resolve, reject) => {
|
|
@@ -577,11 +574,11 @@ class ModuleRegistry {
|
|
|
577
574
|
};
|
|
578
575
|
this.namedDefineRegistry.set(id, moduleDef);
|
|
579
576
|
}
|
|
577
|
+
else if (process.env.NODE_ENV !== 'production' && hasConsole) {
|
|
578
|
+
// eslint-disable-next-line lwr/no-unguarded-apis
|
|
579
|
+
console.warn(MODULE_ALREADY_LOADED.message, id);
|
|
580
|
+
}
|
|
580
581
|
});
|
|
581
|
-
// throw error for modules that were already registered
|
|
582
|
-
if (alreadyRegistered.length) {
|
|
583
|
-
throw new LoaderError(MODULE_ALREADY_LOADED, [alreadyRegistered.join(', ')]);
|
|
584
|
-
}
|
|
585
582
|
}
|
|
586
583
|
checkModuleSignature(name, signature) {
|
|
587
584
|
const moduleDef = this.namedDefineRegistry.get(name);
|
|
@@ -755,7 +752,7 @@ class ModuleRegistry {
|
|
|
755
752
|
moduleDefault = { default: moduleDefault };
|
|
756
753
|
// __defaultInterop is ONLY used to support backwards compatibility
|
|
757
754
|
// of importing default exports the "wrong" way (when not using named exports).
|
|
758
|
-
// See https://github.com/salesforce/lwr/pull/816
|
|
755
|
+
// See https://github.com/salesforce-experience-platform-emu/lwr/pull/816
|
|
759
756
|
Object.defineProperty(moduleDefault, '__defaultInterop', { value: true });
|
|
760
757
|
}
|
|
761
758
|
// if no return value, then we are using the exports object
|
|
@@ -967,7 +964,7 @@ function applyPackages(id, packages, defaultUri) {
|
|
|
967
964
|
// When a specifier's URI cannot be resolved via the imports, fallback to "default".
|
|
968
965
|
// -> https://rfcs.lwc.dev/rfcs/lwr/0000-import-metadata#json-schema
|
|
969
966
|
// However, if `id` is already a fully resolved url,
|
|
970
|
-
// we cannot prepend the defaultUri -> https://github.com/salesforce/lwr/issues/378.
|
|
967
|
+
// we cannot prepend the defaultUri -> https://github.com/salesforce-experience-platform-emu/lwr/issues/378.
|
|
971
968
|
// In this case we do not apply any package mappings and allow the caller (resolveImportMapEntry) to handle it.
|
|
972
969
|
if (!isUrl(id)) {
|
|
973
970
|
return defaultUri + encodeURIComponent(id);
|
|
@@ -1134,7 +1131,7 @@ class Loader {
|
|
|
1134
1131
|
};
|
|
1135
1132
|
}
|
|
1136
1133
|
this.registry = new ModuleRegistry({ baseUrl, profiler });
|
|
1137
|
-
// TODO: https://github.com/salesforce/lwr/issues/1087
|
|
1134
|
+
// TODO: https://github.com/salesforce-experience-platform-emu/lwr/issues/1087
|
|
1138
1135
|
this.services = Object.freeze({
|
|
1139
1136
|
addLoaderPlugin: this.registry.addLoaderPlugin.bind(this.registry),
|
|
1140
1137
|
handleStaleModule: this.registry.registerHandleStaleModuleHook.bind(this.registry),
|
package/package.json
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.9.0-alpha.
|
|
8
|
+
"version": "0.9.0-alpha.30",
|
|
9
9
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/salesforce/lwr.git",
|
|
12
|
+
"url": "https://github.com/salesforce-experience-platform-emu/lwr.git",
|
|
13
13
|
"directory": "packages/@lwrjs/loader"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/salesforce/lwr/issues"
|
|
16
|
+
"url": "https://github.com/salesforce-experience-platform-emu/lwr/issues"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"types": "build/index.d.ts",
|
|
@@ -61,13 +61,14 @@
|
|
|
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
|
-
"@
|
|
65
|
-
"@lwrjs/diagnostics": "0.9.0-alpha.
|
|
66
|
-
"@lwrjs/types": "0.9.0-alpha.
|
|
64
|
+
"@locker/compiler": "0.18.14",
|
|
65
|
+
"@lwrjs/diagnostics": "0.9.0-alpha.30",
|
|
66
|
+
"@lwrjs/types": "0.9.0-alpha.30",
|
|
67
|
+
"rollup": "~2.45.2",
|
|
67
68
|
"rollup-plugin-terser": "^7.0.2"
|
|
68
69
|
},
|
|
69
70
|
"dependencies": {
|
|
70
|
-
"@lwrjs/shared-utils": "0.9.0-alpha.
|
|
71
|
+
"@lwrjs/shared-utils": "0.9.0-alpha.30"
|
|
71
72
|
},
|
|
72
73
|
"lwc": {
|
|
73
74
|
"modules": [
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
]
|
|
83
84
|
},
|
|
84
85
|
"engines": {
|
|
85
|
-
"node": ">=
|
|
86
|
+
"node": ">=16.0.0 <20"
|
|
86
87
|
},
|
|
87
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "6e18768b8e47066c41ae0b792bf4aa766b0b784b"
|
|
88
89
|
}
|