@lwrjs/module-registry 0.9.0-alpha.21 → 0.9.0-alpha.22
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/cjs/index.cjs +10 -3
- package/build/cjs/signature.cjs +2 -8
- package/build/es/index.d.ts +2 -1
- package/build/es/index.js +14 -4
- package/build/es/signature.js +2 -11
- package/package.json +5 -5
package/build/cjs/index.cjs
CHANGED
|
@@ -67,10 +67,17 @@ var LwrModuleRegistry = class {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
resolveModuleUriSync(moduleId, signature, runtimeEnvironment, runtimeParams) {
|
|
71
|
+
const uri = (0, import_esm_strategy.default)(moduleId, runtimeEnvironment, runtimeParams, signature);
|
|
72
|
+
return uri;
|
|
73
|
+
}
|
|
74
|
+
async resolveModuleUri(moduleId, runtimeEnvironment, runtimeParams, signature) {
|
|
71
75
|
if (signature !== void 0) {
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
return this.resolveModuleUriSync(moduleId, signature, runtimeEnvironment, runtimeParams);
|
|
77
|
+
}
|
|
78
|
+
const moduleEntry = await this.getModuleEntry(moduleId, runtimeParams);
|
|
79
|
+
if (moduleEntry.src) {
|
|
80
|
+
return moduleEntry.src;
|
|
74
81
|
}
|
|
75
82
|
const {bundle, format} = runtimeEnvironment;
|
|
76
83
|
if (bundle) {
|
package/build/cjs/signature.cjs
CHANGED
|
@@ -27,11 +27,10 @@ __export(exports, {
|
|
|
27
27
|
getBundleSignature: () => getBundleSignature
|
|
28
28
|
});
|
|
29
29
|
var import_crypto = __toModule(require("crypto"));
|
|
30
|
-
var import_resolve = __toModule(require("resolve"));
|
|
31
30
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
32
|
-
var
|
|
31
|
+
var import_config = __toModule(require("@lwrjs/config"));
|
|
33
32
|
var ENABLED_FINGERPRINTS = !(0, import_shared_utils.getFeatureFlags)().LEGACY_LOADER;
|
|
34
|
-
var ENV_KEY = `LWC:${LWC_VERSION},FINGERPRINTS:${ENABLED_FINGERPRINTS}`;
|
|
33
|
+
var ENV_KEY = `LWC:${import_config.LWC_VERSION},FINGERPRINTS:${ENABLED_FINGERPRINTS}`;
|
|
35
34
|
async function getRecursiveModuleHash(modules, registry, hash, visitedDefinitions = new Set(), excludes = new Set()) {
|
|
36
35
|
if (!modules.length) {
|
|
37
36
|
return;
|
|
@@ -62,8 +61,3 @@ async function getBundleSignature(moduleId, registry, excludes) {
|
|
|
62
61
|
await getRecursiveModuleHash([moduleId], registry, hash, new Set(), new Set(excludes));
|
|
63
62
|
return hash.digest("hex");
|
|
64
63
|
}
|
|
65
|
-
function getLWCVersion() {
|
|
66
|
-
const packageJsonPath = import_resolve.default.sync(`lwc/package.json`);
|
|
67
|
-
const {version} = JSON.parse((0, import_shared_utils.readFile)(packageJsonPath));
|
|
68
|
-
return version;
|
|
69
|
-
}
|
package/build/es/index.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ export declare class LwrModuleRegistry implements ModuleRegistry {
|
|
|
15
15
|
private interchangeableModules?;
|
|
16
16
|
private inflightModuleDefinitions;
|
|
17
17
|
constructor(context: RegistryContext, globalConfig: NormalizedLwrGlobalConfig, registries?: ModuleProvider[]);
|
|
18
|
-
|
|
18
|
+
resolveModuleUriSync<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, signature: S, runtimeEnvironment: R, runtimeParams?: RuntimeParams): string;
|
|
19
|
+
resolveModuleUri<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: R, runtimeParams?: RuntimeParams, signature?: S): Promise<string>;
|
|
19
20
|
addModuleProviders(registries: ModuleProvider[]): void;
|
|
20
21
|
getModuleEntry<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleEntry>;
|
|
21
22
|
getModule<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleDefinition>;
|
package/build/es/index.js
CHANGED
|
@@ -43,11 +43,21 @@ export class LwrModuleRegistry {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
resolveModuleUriSync(moduleId, signature, runtimeEnvironment, runtimeParams) {
|
|
47
|
+
const uri = esmLinkingStrategy(moduleId, runtimeEnvironment, runtimeParams, signature);
|
|
48
|
+
return uri;
|
|
49
|
+
}
|
|
50
|
+
async resolveModuleUri(moduleId, runtimeEnvironment, runtimeParams, signature) {
|
|
51
|
+
// If we have a signature just sync resolve the uri
|
|
47
52
|
if (signature !== undefined) {
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
return this.resolveModuleUriSync(moduleId, signature, runtimeEnvironment, runtimeParams);
|
|
54
|
+
}
|
|
55
|
+
// Get the module entry to see if the src is provided by the provider.
|
|
56
|
+
const moduleEntry = await this.getModuleEntry(moduleId, runtimeParams);
|
|
57
|
+
if (moduleEntry.src) {
|
|
58
|
+
return moduleEntry.src;
|
|
50
59
|
}
|
|
60
|
+
// Else compute the URL from source
|
|
51
61
|
const { bundle, format } = runtimeEnvironment;
|
|
52
62
|
if (bundle) {
|
|
53
63
|
return new Promise((resolve, reject) => {
|
|
@@ -55,7 +65,7 @@ export class LwrModuleRegistry {
|
|
|
55
65
|
.then((bundleSignature) => resolve(esmLinkingStrategy(moduleId, runtimeEnvironment, runtimeParams, bundleSignature)))
|
|
56
66
|
.catch(reject);
|
|
57
67
|
});
|
|
58
|
-
// For individual files we a module URL
|
|
68
|
+
// For individual files we return a module URL
|
|
59
69
|
}
|
|
60
70
|
else {
|
|
61
71
|
return new Promise((resolve, reject) => {
|
package/build/es/signature.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
const LWC_VERSION = getLWCVersion();
|
|
2
|
+
import { getFeatureFlags, getSpecifier } from '@lwrjs/shared-utils';
|
|
3
|
+
import { LWC_VERSION } from '@lwrjs/config';
|
|
5
4
|
const ENABLED_FINGERPRINTS = !getFeatureFlags().LEGACY_LOADER;
|
|
6
5
|
const ENV_KEY = `LWC:${LWC_VERSION},FINGERPRINTS:${ENABLED_FINGERPRINTS}`;
|
|
7
6
|
async function getRecursiveModuleHash(modules, registry, hash, visitedDefinitions = new Set(), excludes = new Set()) {
|
|
@@ -65,12 +64,4 @@ export async function getBundleSignature(moduleId, registry, excludes) {
|
|
|
65
64
|
await getRecursiveModuleHash([moduleId], registry, hash, new Set(), new Set(excludes));
|
|
66
65
|
return hash.digest('hex');
|
|
67
66
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Get the configured LWC version
|
|
70
|
-
*/
|
|
71
|
-
function getLWCVersion() {
|
|
72
|
-
const packageJsonPath = resolve.sync(`lwc/package.json`);
|
|
73
|
-
const { version } = JSON.parse(readFile(packageJsonPath));
|
|
74
|
-
return version;
|
|
75
|
-
}
|
|
76
67
|
//# sourceMappingURL=signature.js.map
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.9.0-alpha.
|
|
7
|
+
"version": "0.9.0-alpha.22",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@locker/compiler": "0.18.9",
|
|
34
|
-
"@lwrjs/diagnostics": "0.9.0-alpha.
|
|
35
|
-
"@lwrjs/shared-utils": "0.9.0-alpha.
|
|
34
|
+
"@lwrjs/diagnostics": "0.9.0-alpha.22",
|
|
35
|
+
"@lwrjs/shared-utils": "0.9.0-alpha.22",
|
|
36
36
|
"es-module-lexer": "^0.3.18",
|
|
37
37
|
"rollup": "~2.45.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@lwrjs/types": "0.9.0-alpha.
|
|
40
|
+
"@lwrjs/types": "0.9.0-alpha.22",
|
|
41
41
|
"@types/es-module-lexer": "^0.3.0"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=14.15.4 <19"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "d7e7a6e84df652a09d78b9b0fadca271a438a01c"
|
|
47
47
|
}
|