@lwrjs/view-registry 0.9.0-alpha.13 → 0.9.0-alpha.14
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.
|
@@ -42,6 +42,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
42
42
|
const {id: appName, bootstrap: {services} = {services: []}} = view;
|
|
43
43
|
const {lwrVersion, format, hmrEnabled, bundle, debug, minify} = runtimeEnvironment;
|
|
44
44
|
const {customElements} = viewMetadata;
|
|
45
|
+
const defRegistry = bundle ? moduleBundler : moduleRegistry;
|
|
45
46
|
const version = lwrVersion;
|
|
46
47
|
const isAMD = format === "amd";
|
|
47
48
|
const appIdentity = {
|
|
@@ -84,7 +85,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
const depth = isAMD ? {static: import_shared_utils.GraphDepth.ALL, dynamic: 1} : {static: import_shared_utils.GraphDepth.NONE, dynamic: 1};
|
|
87
|
-
const bootstrapModuleGraph = await (0, import_shared_utils.getModuleGraphs)(bootstrapSpecifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry,
|
|
88
|
+
const bootstrapModuleGraph = await (0, import_shared_utils.getModuleGraphs)(bootstrapSpecifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visitedCache);
|
|
88
89
|
const versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
|
|
89
90
|
const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
|
|
90
91
|
moduleResources.push((0, import_utils.getModuleResourceByUri)(uri, runtimeEnvironment, {isPreload: false, isSSR}));
|
|
@@ -108,11 +109,11 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
let importMetadata = await (0, import_shared_utils.toImportMetadata)(bootstrapModuleGraph, {imports: {}, index: {}},
|
|
112
|
+
let importMetadata = await (0, import_shared_utils.toImportMetadata)(bootstrapModuleGraph, {imports: {}, index: {}}, defRegistry, runtimeEnvironment, runtimeParams);
|
|
112
113
|
const customElementsRecords = [];
|
|
113
114
|
const flattenedElements = (0, import_utils2.flattenCustomElements)(customElements, isSSR);
|
|
114
115
|
for (const {tagName: element} of flattenedElements) {
|
|
115
|
-
const graph = await (0, import_shared_utils.getModuleGraphs)((0, import_shared_utils.kebabCaseToModuleSpecifer)(element), {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry,
|
|
116
|
+
const graph = await (0, import_shared_utils.getModuleGraphs)((0, import_shared_utils.kebabCaseToModuleSpecifer)(element), {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
|
|
116
117
|
customElementsRecords.push({elementName: element, flatGraph: graph});
|
|
117
118
|
const specifier = graph.graphs[0].specifier;
|
|
118
119
|
const uri2 = graph.uriMap[specifier];
|
|
@@ -130,7 +131,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
130
131
|
imports[dynamicDep] = uri3;
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
|
-
importMetadata = await (0, import_shared_utils.toImportMetadata)(graph, importMetadata,
|
|
134
|
+
importMetadata = await (0, import_shared_utils.toImportMetadata)(graph, importMetadata, defRegistry, runtimeEnvironment, runtimeParams);
|
|
134
135
|
}
|
|
135
136
|
configResources.unshift(await (0, import_utils2.getViewBootstrapConfigurationResource)({
|
|
136
137
|
id: view.id,
|
package/build/cjs/utils.cjs
CHANGED
|
@@ -212,10 +212,10 @@ async function toJsonFormat(viewRequest, viewDefinition, route, runtimeEnvironme
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
async function getModuleResource(moduleId, runtimeEnvironment, moduleResouceMeta,
|
|
215
|
+
async function getModuleResource(moduleId, runtimeEnvironment, moduleResouceMeta, defRegistry, runtimeParams) {
|
|
216
216
|
const {format} = runtimeEnvironment;
|
|
217
217
|
const {isSSR = false, isPreload = false} = moduleResouceMeta;
|
|
218
|
-
const moduleUri = await
|
|
218
|
+
const moduleUri = await defRegistry.resolveModuleUri(moduleId, runtimeEnvironment, runtimeParams);
|
|
219
219
|
return {
|
|
220
220
|
src: moduleUri,
|
|
221
221
|
type: format === "amd" ? "application/javascript" : "module",
|
|
@@ -7,6 +7,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
7
7
|
const { id: appName, bootstrap: { services } = { services: [] } } = view;
|
|
8
8
|
const { lwrVersion, format, hmrEnabled, bundle, debug, minify } = runtimeEnvironment;
|
|
9
9
|
const { customElements } = viewMetadata;
|
|
10
|
+
const defRegistry = bundle ? moduleBundler : moduleRegistry;
|
|
10
11
|
const version = lwrVersion;
|
|
11
12
|
const isAMD = format === 'amd';
|
|
12
13
|
// Application Bootstrap (ABS) module resource: "@lwrjs/app-service/{appName}/module/{format}"
|
|
@@ -81,7 +82,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
81
82
|
const depth = isAMD
|
|
82
83
|
? { static: GraphDepth.ALL, dynamic: 1 }
|
|
83
84
|
: { static: GraphDepth.NONE, dynamic: 1 };
|
|
84
|
-
const bootstrapModuleGraph = await getModuleGraphs(bootstrapSpecifier, { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry,
|
|
85
|
+
const bootstrapModuleGraph = await getModuleGraphs(bootstrapSpecifier, { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visitedCache);
|
|
85
86
|
// ADD bootstrap module uri as a script resource
|
|
86
87
|
const versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
|
|
87
88
|
const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
|
|
@@ -114,13 +115,13 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
let importMetadata = await toImportMetadata(bootstrapModuleGraph, { imports: {}, index: {} },
|
|
118
|
+
let importMetadata = await toImportMetadata(bootstrapModuleGraph, { imports: {}, index: {} }, defRegistry, runtimeEnvironment, runtimeParams);
|
|
118
119
|
// ------- View related custom element moduleResources
|
|
119
120
|
const customElementsRecords = [];
|
|
120
121
|
const flattenedElements = flattenCustomElements(customElements, isSSR);
|
|
121
122
|
for (const { tagName: element } of flattenedElements) {
|
|
122
123
|
// eslint-disable-next-line no-await-in-loop
|
|
123
|
-
const graph = await getModuleGraphs(kebabCaseToModuleSpecifer(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry,
|
|
124
|
+
const graph = await getModuleGraphs(kebabCaseToModuleSpecifer(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
|
|
124
125
|
// add to the viewRecord
|
|
125
126
|
customElementsRecords.push({ elementName: element, flatGraph: graph });
|
|
126
127
|
// PRELOAD custom element static deps as link resource
|
|
@@ -144,7 +145,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
// eslint-disable-next-line no-await-in-loop
|
|
147
|
-
importMetadata = await toImportMetadata(graph, importMetadata,
|
|
148
|
+
importMetadata = await toImportMetadata(graph, importMetadata, defRegistry, runtimeEnvironment, runtimeParams);
|
|
148
149
|
}
|
|
149
150
|
// ADD configuration of the bootstrapModule
|
|
150
151
|
configResources.unshift(await getViewBootstrapConfigurationResource({
|
package/build/es/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AssetReference, JsonCompatible, LinkedViewDefinition, LwrErrorRoute, LwrRoute, ModuleBundler, ModuleId, ModuleJson, ModuleRegistry, NormalizedRenderingResult, PublicModuleRegistry, RenderOptions, RenderedAssetReference, RenderingResult, ResourceDefinition, Route, RouteHandlerViewResponse, RuntimeEnvironment, RuntimeParams, ViewModuleResourceContext, ViewPageContext, ViewRequest, ViewResponse } from '@lwrjs/types';
|
|
2
2
|
export declare type HTMLResource = Partial<ResourceDefinition>;
|
|
3
3
|
export declare function generateHtmlTag(definition: HTMLResource): Promise<string>;
|
|
4
4
|
export declare function normalizeRenderedResult({ renderedView, metadata, options, }: RenderingResult): NormalizedRenderingResult;
|
|
@@ -7,7 +7,7 @@ export declare function normalizeRenderOptions(runtimeEnvironment: RuntimeEnviro
|
|
|
7
7
|
export declare function generatePageContext({ requestPath: url }: ViewRequest, { id, contentTemplate, properties }: Route<LwrRoute | LwrErrorRoute>): JsonCompatible<ViewPageContext>;
|
|
8
8
|
export declare function isViewResponse(response: RouteHandlerViewResponse): response is ViewResponse;
|
|
9
9
|
export declare function toJsonFormat(viewRequest: ViewRequest, viewDefinition: LinkedViewDefinition, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams, moduleRegistry: ModuleRegistry): Promise<ViewResponse>;
|
|
10
|
-
export declare function getModuleResource(moduleId: Pick<ModuleId, 'specifier' | 'version'>, runtimeEnvironment: RuntimeEnvironment, moduleResouceMeta: ViewModuleResourceContext,
|
|
10
|
+
export declare function getModuleResource(moduleId: Pick<ModuleId, 'specifier' | 'version'>, runtimeEnvironment: RuntimeEnvironment, moduleResouceMeta: ViewModuleResourceContext, defRegistry: ModuleRegistry | ModuleBundler, runtimeParams?: RuntimeParams): Promise<ResourceDefinition>;
|
|
11
11
|
export declare function getModuleResourceByUri(uri: string, runtimeEnvironment: RuntimeEnvironment, moduleResouceMeta: ViewModuleResourceContext): ResourceDefinition;
|
|
12
12
|
export declare function createJsonModule(specifier: string, moduleRegistry: PublicModuleRegistry, environment: RuntimeEnvironment, params?: RuntimeParams): Promise<ModuleJson>;
|
|
13
13
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/es/utils.js
CHANGED
|
@@ -191,10 +191,10 @@ export async function toJsonFormat(viewRequest, viewDefinition, route, runtimeEn
|
|
|
191
191
|
},
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
export async function getModuleResource(moduleId, runtimeEnvironment, moduleResouceMeta,
|
|
194
|
+
export async function getModuleResource(moduleId, runtimeEnvironment, moduleResouceMeta, defRegistry, runtimeParams) {
|
|
195
195
|
const { format } = runtimeEnvironment;
|
|
196
196
|
const { isSSR = false, isPreload = false } = moduleResouceMeta;
|
|
197
|
-
const moduleUri = await
|
|
197
|
+
const moduleUri = await defRegistry.resolveModuleUri(moduleId, runtimeEnvironment, runtimeParams);
|
|
198
198
|
return {
|
|
199
199
|
src: moduleUri,
|
|
200
200
|
type: format === 'amd' ? 'application/javascript' : 'module',
|
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.14",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/app-service": "0.9.0-alpha.
|
|
34
|
-
"@lwrjs/diagnostics": "0.9.0-alpha.
|
|
35
|
-
"@lwrjs/shared-utils": "0.9.0-alpha.
|
|
33
|
+
"@lwrjs/app-service": "0.9.0-alpha.14",
|
|
34
|
+
"@lwrjs/diagnostics": "0.9.0-alpha.14",
|
|
35
|
+
"@lwrjs/shared-utils": "0.9.0-alpha.14"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@lwrjs/types": "0.9.0-alpha.
|
|
38
|
+
"@lwrjs/types": "0.9.0-alpha.14"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=14.15.4 <19"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "64e0ba617151429da6e09f1a9686628f64183d25"
|
|
44
44
|
}
|