@lwrjs/core 0.10.2 → 0.11.0-alpha.1
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 +1 -1
- package/build/cjs/middleware/bundle-middleware.cjs +1 -1
- package/build/cjs/middleware/module-middleware.cjs +1 -1
- package/build/cjs/middleware/redirects/unsigned-module-redirect.cjs +1 -1
- package/build/cjs/middleware/utils/metadata.cjs +2 -2
- package/build/cjs/middleware/utils/request.cjs +2 -2
- package/build/es/index.js +1 -1
- package/build/es/middleware/bundle-middleware.js +3 -1
- package/build/es/middleware/module-middleware.js +3 -1
- package/build/es/middleware/redirects/unsigned-module-redirect.js +1 -1
- package/build/es/middleware/utils/metadata.js +2 -2
- package/build/es/middleware/utils/request.d.ts +2 -2
- package/build/es/middleware/utils/request.js +2 -2
- package/package.json +28 -28
package/build/cjs/index.cjs
CHANGED
|
@@ -69,7 +69,7 @@ async function initContext(appConfig, runtimeEnvironment, globalData) {
|
|
|
69
69
|
const skipValidation = true;
|
|
70
70
|
await (0, import_config.executeConfigHooks)(hooks, appConfig, runtimeEnvironment, globalData, skipValidation);
|
|
71
71
|
(0, import_config.executeInstrumentationHooks)(hooks);
|
|
72
|
-
(0, import_config.executeStartHooks)(hooks, appConfig);
|
|
72
|
+
(0, import_config.executeStartHooks)(hooks, appConfig, runtimeEnvironment);
|
|
73
73
|
}
|
|
74
74
|
const services = await (0, import_modules.loadServices)(appConfig);
|
|
75
75
|
const serverContext = (0, import_instrumentation.getTracer)().trace({name: import_instrumentation.CoreSpan.CreateServerContext}, () => (0, import_server2.createServerContext)(appConfig, runtimeEnvironment, globalData));
|
|
@@ -48,7 +48,7 @@ function createBundleMiddleware(context) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
const {runtimeEnvironment, runtimeParams} = req.getRuntimeContext(context.runtimeEnvironment);
|
|
51
|
-
const importer = req.query.importer ? await (0, import_request.getRequestImporter)(req, moduleRegistry) : void 0;
|
|
51
|
+
const importer = req.query.importer ? await (0, import_request.getRequestImporter)(req, moduleRegistry, runtimeParams) : void 0;
|
|
52
52
|
const {moduleId, signature} = (0, import_identity.getModuleIdentity)(req, importer);
|
|
53
53
|
if (moduleId.importer || !signature) {
|
|
54
54
|
await unsignedBundleRedirect(req, res, moduleId, runtimeEnvironment, runtimeParams);
|
|
@@ -47,7 +47,7 @@ function createModuleMiddleware(context) {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
const {runtimeEnvironment, runtimeParams} = req.getRuntimeContext(context.runtimeEnvironment);
|
|
50
|
-
const importer = req.query.importer ? await (0, import_request.getRequestImporter)(req, moduleRegistry) : void 0;
|
|
50
|
+
const importer = req.query.importer ? await (0, import_request.getRequestImporter)(req, moduleRegistry, runtimeParams) : void 0;
|
|
51
51
|
const {moduleId, signature} = (0, import_identity.getModuleIdentity)(req, importer);
|
|
52
52
|
if (moduleId.importer || !signature) {
|
|
53
53
|
await unsignedRedirect(req, res, moduleId, runtimeEnvironment, runtimeParams);
|
|
@@ -16,7 +16,7 @@ var STATUS_FOUND = 302;
|
|
|
16
16
|
function createUnsignedModuleRedirect(moduleRegistry) {
|
|
17
17
|
return async (req, res, moduleId, runtimeEnvironment, runtimeParams) => {
|
|
18
18
|
const jsonQuery = getJsonQualifier(req, runtimeEnvironment);
|
|
19
|
-
const {moduleEntry, ownHash} = await moduleRegistry.getModule(moduleId);
|
|
19
|
+
const {moduleEntry, ownHash} = await moduleRegistry.getModule(moduleId, runtimeParams);
|
|
20
20
|
const uri = await moduleRegistry.resolveModuleUri({...moduleId, version: moduleEntry.version}, runtimeEnvironment, runtimeParams, ownHash);
|
|
21
21
|
sendRedirect(res, `${uri}${jsonQuery}`);
|
|
22
22
|
};
|
|
@@ -32,7 +32,7 @@ async function normalizeResolvedUris(bundleDefinition, runtimeEnvironment, runti
|
|
|
32
32
|
if (bundleDefinition.bundleRecord.imports) {
|
|
33
33
|
for (const theImport of bundleDefinition.bundleRecord.imports) {
|
|
34
34
|
const childSpecifier = theImport.specifier;
|
|
35
|
-
const id = await (0, import_shared_utils.getVersionedModuleId)(childSpecifier, moduleRegistry);
|
|
35
|
+
const id = await (0, import_shared_utils.getVersionedModuleId)(childSpecifier, moduleRegistry, runtimeParams);
|
|
36
36
|
const uri = await moduleBundler.resolveModuleUri(id, runtimeEnvironment, runtimeParams);
|
|
37
37
|
resolvedUris.push(uri);
|
|
38
38
|
}
|
|
@@ -40,7 +40,7 @@ async function normalizeResolvedUris(bundleDefinition, runtimeEnvironment, runti
|
|
|
40
40
|
if (bundleDefinition.bundleRecord.dynamicImports) {
|
|
41
41
|
for (const theImport of bundleDefinition.bundleRecord.dynamicImports) {
|
|
42
42
|
const childSpecifier = theImport.specifier;
|
|
43
|
-
const id = await (0, import_shared_utils.getVersionedModuleId)(childSpecifier, moduleRegistry);
|
|
43
|
+
const id = await (0, import_shared_utils.getVersionedModuleId)(childSpecifier, moduleRegistry, runtimeParams);
|
|
44
44
|
const uri = await moduleBundler.resolveModuleUri(id, runtimeEnvironment, runtimeParams);
|
|
45
45
|
resolvedUris.push(uri);
|
|
46
46
|
}
|
|
@@ -61,9 +61,9 @@ function getRequestProperties(pattern, req) {
|
|
|
61
61
|
}
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
async function getRequestImporter(req, moduleRegistry) {
|
|
64
|
+
async function getRequestImporter(req, moduleRegistry, runtimeParams) {
|
|
65
65
|
const importerSpecifier = req.query.importer;
|
|
66
66
|
const importerModuleId = (0, import_shared_utils.explodeSpecifier)(importerSpecifier);
|
|
67
|
-
const {entry} = await moduleRegistry.getModuleEntry(importerModuleId);
|
|
67
|
+
const {entry} = await moduleRegistry.getModuleEntry(importerModuleId, runtimeParams);
|
|
68
68
|
return entry;
|
|
69
69
|
}
|
package/build/es/index.js
CHANGED
|
@@ -46,7 +46,7 @@ async function initContext(appConfig, runtimeEnvironment, globalData) {
|
|
|
46
46
|
const skipValidation = true; // skip for config hook, since `executeStartHooks` hook will validate
|
|
47
47
|
await executeConfigHooks(hooks, appConfig, runtimeEnvironment, globalData, skipValidation);
|
|
48
48
|
executeInstrumentationHooks(hooks);
|
|
49
|
-
executeStartHooks(hooks, appConfig);
|
|
49
|
+
executeStartHooks(hooks, appConfig, runtimeEnvironment);
|
|
50
50
|
}
|
|
51
51
|
// load all configurable modules
|
|
52
52
|
const services = await loadServices(appConfig);
|
|
@@ -20,7 +20,9 @@ function createBundleMiddleware(context) {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
const { runtimeEnvironment, runtimeParams } = req.getRuntimeContext(context.runtimeEnvironment);
|
|
23
|
-
const importer = req.query.importer
|
|
23
|
+
const importer = req.query.importer
|
|
24
|
+
? await getRequestImporter(req, moduleRegistry, runtimeParams)
|
|
25
|
+
: undefined;
|
|
24
26
|
const { moduleId, signature } = getModuleIdentity(req, importer);
|
|
25
27
|
if (moduleId.importer || !signature) {
|
|
26
28
|
await unsignedBundleRedirect(req, res, moduleId, runtimeEnvironment, runtimeParams);
|
|
@@ -19,7 +19,9 @@ function createModuleMiddleware(context) {
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
const { runtimeEnvironment, runtimeParams } = req.getRuntimeContext(context.runtimeEnvironment);
|
|
22
|
-
const importer = req.query.importer
|
|
22
|
+
const importer = req.query.importer
|
|
23
|
+
? await getRequestImporter(req, moduleRegistry, runtimeParams)
|
|
24
|
+
: undefined;
|
|
23
25
|
const { moduleId, signature } = getModuleIdentity(req, importer);
|
|
24
26
|
if (moduleId.importer || !signature) {
|
|
25
27
|
await unsignedRedirect(req, res, moduleId, runtimeEnvironment, runtimeParams);
|
|
@@ -3,7 +3,7 @@ const STATUS_FOUND = 302;
|
|
|
3
3
|
export function createUnsignedModuleRedirect(moduleRegistry) {
|
|
4
4
|
return async (req, res, moduleId, runtimeEnvironment, runtimeParams) => {
|
|
5
5
|
const jsonQuery = getJsonQualifier(req, runtimeEnvironment);
|
|
6
|
-
const { moduleEntry, ownHash } = await moduleRegistry.getModule(moduleId);
|
|
6
|
+
const { moduleEntry, ownHash } = await moduleRegistry.getModule(moduleId, runtimeParams);
|
|
7
7
|
const uri = await moduleRegistry.resolveModuleUri({ ...moduleId, version: moduleEntry.version }, runtimeEnvironment, runtimeParams, ownHash);
|
|
8
8
|
sendRedirect(res, `${uri}${jsonQuery}`);
|
|
9
9
|
};
|
|
@@ -6,7 +6,7 @@ export async function normalizeResolvedUris(bundleDefinition, runtimeEnvironment
|
|
|
6
6
|
if (bundleDefinition.bundleRecord.imports) {
|
|
7
7
|
for (const theImport of bundleDefinition.bundleRecord.imports) {
|
|
8
8
|
const childSpecifier = theImport.specifier;
|
|
9
|
-
const id = await getVersionedModuleId(childSpecifier, moduleRegistry);
|
|
9
|
+
const id = await getVersionedModuleId(childSpecifier, moduleRegistry, runtimeParams);
|
|
10
10
|
const uri = await moduleBundler.resolveModuleUri(id, runtimeEnvironment, runtimeParams);
|
|
11
11
|
resolvedUris.push(uri);
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ export async function normalizeResolvedUris(bundleDefinition, runtimeEnvironment
|
|
|
14
14
|
if (bundleDefinition.bundleRecord.dynamicImports) {
|
|
15
15
|
for (const theImport of bundleDefinition.bundleRecord.dynamicImports) {
|
|
16
16
|
const childSpecifier = theImport.specifier;
|
|
17
|
-
const id = await getVersionedModuleId(childSpecifier, moduleRegistry);
|
|
17
|
+
const id = await getVersionedModuleId(childSpecifier, moduleRegistry, runtimeParams);
|
|
18
18
|
const uri = await moduleBundler.resolveModuleUri(id, runtimeEnvironment, runtimeParams);
|
|
19
19
|
resolvedUris.push(uri);
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { MiddlewareRequest, ModuleRegistry } from '@lwrjs/types';
|
|
2
|
+
import type { MiddlewareRequest, ModuleRegistry, RuntimeParams } from '@lwrjs/types';
|
|
3
3
|
import type http from 'http';
|
|
4
4
|
import qs from 'qs';
|
|
5
5
|
interface Params {
|
|
@@ -10,6 +10,6 @@ export declare function getRequestProperties(pattern: string, req: http.Incoming
|
|
|
10
10
|
params: Params;
|
|
11
11
|
query: qs.ParsedQs;
|
|
12
12
|
} | undefined;
|
|
13
|
-
export declare function getRequestImporter(req: MiddlewareRequest, moduleRegistry: ModuleRegistry): Promise<string>;
|
|
13
|
+
export declare function getRequestImporter(req: MiddlewareRequest, moduleRegistry: ModuleRegistry, runtimeParams: RuntimeParams): Promise<string>;
|
|
14
14
|
export {};
|
|
15
15
|
//# sourceMappingURL=request.d.ts.map
|
|
@@ -33,10 +33,10 @@ export function getRequestProperties(pattern, req) {
|
|
|
33
33
|
}
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
export async function getRequestImporter(req, moduleRegistry) {
|
|
36
|
+
export async function getRequestImporter(req, moduleRegistry, runtimeParams) {
|
|
37
37
|
const importerSpecifier = req.query.importer;
|
|
38
38
|
const importerModuleId = explodeSpecifier(importerSpecifier);
|
|
39
|
-
const { entry } = await moduleRegistry.getModuleEntry(importerModuleId);
|
|
39
|
+
const { entry } = await moduleRegistry.getModuleEntry(importerModuleId, runtimeParams);
|
|
40
40
|
return entry;
|
|
41
41
|
}
|
|
42
42
|
//# sourceMappingURL=request.js.map
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.11.0-alpha.1",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -39,31 +39,31 @@
|
|
|
39
39
|
"build": "tsc -b"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@lwrjs/app-service": "0.
|
|
43
|
-
"@lwrjs/asset-registry": "0.
|
|
44
|
-
"@lwrjs/asset-transformer": "0.
|
|
45
|
-
"@lwrjs/base-view-provider": "0.
|
|
46
|
-
"@lwrjs/base-view-transformer": "0.
|
|
47
|
-
"@lwrjs/client-modules": "0.
|
|
48
|
-
"@lwrjs/config": "0.
|
|
49
|
-
"@lwrjs/diagnostics": "0.
|
|
50
|
-
"@lwrjs/fs-asset-provider": "0.
|
|
51
|
-
"@lwrjs/html-view-provider": "0.
|
|
52
|
-
"@lwrjs/instrumentation": "0.
|
|
53
|
-
"@lwrjs/loader": "0.
|
|
54
|
-
"@lwrjs/lwc-module-provider": "0.
|
|
55
|
-
"@lwrjs/markdown-view-provider": "0.
|
|
56
|
-
"@lwrjs/module-bundler": "0.
|
|
57
|
-
"@lwrjs/module-registry": "0.
|
|
58
|
-
"@lwrjs/npm-module-provider": "0.
|
|
59
|
-
"@lwrjs/nunjucks-view-provider": "0.
|
|
60
|
-
"@lwrjs/o11y": "0.
|
|
61
|
-
"@lwrjs/resource-registry": "0.
|
|
62
|
-
"@lwrjs/router": "0.
|
|
63
|
-
"@lwrjs/server": "0.
|
|
64
|
-
"@lwrjs/shared-utils": "0.
|
|
65
|
-
"@lwrjs/static": "0.
|
|
66
|
-
"@lwrjs/view-registry": "0.
|
|
42
|
+
"@lwrjs/app-service": "0.11.0-alpha.1",
|
|
43
|
+
"@lwrjs/asset-registry": "0.11.0-alpha.1",
|
|
44
|
+
"@lwrjs/asset-transformer": "0.11.0-alpha.1",
|
|
45
|
+
"@lwrjs/base-view-provider": "0.11.0-alpha.1",
|
|
46
|
+
"@lwrjs/base-view-transformer": "0.11.0-alpha.1",
|
|
47
|
+
"@lwrjs/client-modules": "0.11.0-alpha.1",
|
|
48
|
+
"@lwrjs/config": "0.11.0-alpha.1",
|
|
49
|
+
"@lwrjs/diagnostics": "0.11.0-alpha.1",
|
|
50
|
+
"@lwrjs/fs-asset-provider": "0.11.0-alpha.1",
|
|
51
|
+
"@lwrjs/html-view-provider": "0.11.0-alpha.1",
|
|
52
|
+
"@lwrjs/instrumentation": "0.11.0-alpha.1",
|
|
53
|
+
"@lwrjs/loader": "0.11.0-alpha.1",
|
|
54
|
+
"@lwrjs/lwc-module-provider": "0.11.0-alpha.1",
|
|
55
|
+
"@lwrjs/markdown-view-provider": "0.11.0-alpha.1",
|
|
56
|
+
"@lwrjs/module-bundler": "0.11.0-alpha.1",
|
|
57
|
+
"@lwrjs/module-registry": "0.11.0-alpha.1",
|
|
58
|
+
"@lwrjs/npm-module-provider": "0.11.0-alpha.1",
|
|
59
|
+
"@lwrjs/nunjucks-view-provider": "0.11.0-alpha.1",
|
|
60
|
+
"@lwrjs/o11y": "0.11.0-alpha.1",
|
|
61
|
+
"@lwrjs/resource-registry": "0.11.0-alpha.1",
|
|
62
|
+
"@lwrjs/router": "0.11.0-alpha.1",
|
|
63
|
+
"@lwrjs/server": "0.11.0-alpha.1",
|
|
64
|
+
"@lwrjs/shared-utils": "0.11.0-alpha.1",
|
|
65
|
+
"@lwrjs/static": "0.11.0-alpha.1",
|
|
66
|
+
"@lwrjs/view-registry": "0.11.0-alpha.1",
|
|
67
67
|
"chokidar": "^3.5.3",
|
|
68
68
|
"esbuild": "^0.9.7",
|
|
69
69
|
"fs-extra": "^11.1.1",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"ws": "^8.8.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@lwrjs/types": "0.
|
|
76
|
+
"@lwrjs/types": "0.11.0-alpha.1",
|
|
77
77
|
"@types/ws": "^8.5.3"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"volta": {
|
|
86
86
|
"extends": "../../../package.json"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "6a840d4694fac9f0be5c3a21707015379cbadad7"
|
|
89
89
|
}
|