@lwrjs/view-registry 0.10.0-alpha.14 → 0.10.0-alpha.15
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.
|
@@ -82,8 +82,8 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
82
82
|
let bootstrapModuleRef, versionedSpecifier = bootstrapSpecifier;
|
|
83
83
|
const customElementsRecords = [];
|
|
84
84
|
const flattenedElements = (0, import_utils2.flattenCustomElements)(customElements, isSSR);
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
85
|
+
const viewContainsLiveElements = !isSSR || flattenedElements.some(({props}) => (0, import_shared_utils.getHydrateDirective)(props));
|
|
86
|
+
if (viewContainsLiveElements) {
|
|
87
87
|
if (isAMD) {
|
|
88
88
|
const shimBundle = debug || minify === false ? "lwr-loader-shim-legacy.bundle.js" : "lwr-loader-shim-legacy.bundle.min.js";
|
|
89
89
|
let def = await resourceRegistry.getResource({specifier: shimBundle, version}, runtimeEnvironment, runtimeParams);
|
|
@@ -150,7 +150,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
150
150
|
await Promise.all(flattenedElements.map(async ({tagName: element, props}) => {
|
|
151
151
|
const graph = await (0, import_shared_utils.getModuleGraphs)((0, import_shared_utils.kebabCaseToModuleSpecifier)(element), {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
|
|
152
152
|
customElementsRecords.push({elementName: element, flatGraph: graph});
|
|
153
|
-
if (!isSSR || (0, import_shared_utils.
|
|
153
|
+
if (!isSSR || (0, import_shared_utils.getHydrateDirective)(props)) {
|
|
154
154
|
const specifier = graph.graphs[0].specifier;
|
|
155
155
|
const uri = graph.uriMap[specifier];
|
|
156
156
|
(0, import_preload_utils.setPreloadModulesMeta)(specifier, uri, groups, viewPreloads);
|
|
@@ -176,7 +176,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}));
|
|
179
|
-
if (
|
|
179
|
+
if (viewContainsLiveElements) {
|
|
180
180
|
configResources.unshift((0, import_utils2.getViewBootstrapConfigurationResource)({
|
|
181
181
|
id: view.id,
|
|
182
182
|
url: viewParams?.page?.url,
|
|
@@ -83,8 +83,8 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
83
83
|
let importMetadata = {imports: {}};
|
|
84
84
|
const customElementsRecords = [];
|
|
85
85
|
const flattenedElements = (0, import_utils2.flattenCustomElements)(customElements, isSSR);
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
86
|
+
const viewContainsLiveElements = !isSSR || flattenedElements.some(({props}) => (0, import_shared_utils.getHydrateDirective)(props));
|
|
87
|
+
if (viewContainsLiveElements) {
|
|
88
88
|
if (isAMD) {
|
|
89
89
|
const shimBundle = debug || minify === false ? "lwr-loader-shim.bundle.js" : "lwr-loader-shim.bundle.min.js";
|
|
90
90
|
const def = await resourceRegistry.getResource({specifier: shimBundle, version}, runtimeEnvironment, runtimeParams);
|
|
@@ -142,7 +142,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
142
142
|
for (const {tagName: element, props} of flattenedElements) {
|
|
143
143
|
const graph = await (0, import_shared_utils.getModuleGraphs)((0, import_shared_utils.kebabCaseToModuleSpecifier)(element), {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
|
|
144
144
|
customElementsRecords.push({elementName: element, flatGraph: graph});
|
|
145
|
-
if (!isSSR || (0, import_shared_utils.
|
|
145
|
+
if (!isSSR || (0, import_shared_utils.getHydrateDirective)(props)) {
|
|
146
146
|
const specifier = graph.graphs[0].specifier;
|
|
147
147
|
const uri = graph.uriMap[specifier];
|
|
148
148
|
(0, import_preload_utils.setPreloadModulesMeta)(specifier, uri, groups, viewPreloads);
|
|
@@ -169,7 +169,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
169
169
|
importMetadata = await (0, import_shared_utils.toImportMetadata)(graph, importMetadata, moduleRegistry, runtimeEnvironment, runtimeParams);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
if (
|
|
172
|
+
if (viewContainsLiveElements) {
|
|
173
173
|
configResources.unshift((0, import_utils2.getViewBootstrapConfigurationResource)({
|
|
174
174
|
id: view.id,
|
|
175
175
|
url: viewParams?.page?.url,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { kebabCaseToModuleSpecifier, getModuleGraphs, GraphDepth, getModuleUriPrefix, logger, explodeSpecifier, isBundler,
|
|
1
|
+
import { kebabCaseToModuleSpecifier, getModuleGraphs, GraphDepth, getModuleUriPrefix, logger, explodeSpecifier, isBundler, getHydrateDirective, } from '@lwrjs/shared-utils';
|
|
2
2
|
import { AppResourceEnum, getAppSpecifier } from '@lwrjs/app-service/identity';
|
|
3
3
|
import { generateHtmlTag, getModuleResourceByUri } from '../utils.js';
|
|
4
4
|
import { flattenCustomElements, getViewBootstrapConfigurationResource, getViewHmrConfigurationResource, } from './utils.js';
|
|
@@ -67,8 +67,8 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
67
67
|
let bootstrapModuleRef, versionedSpecifier = bootstrapSpecifier;
|
|
68
68
|
const customElementsRecords = [];
|
|
69
69
|
const flattenedElements = flattenCustomElements(customElements, isSSR);
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
70
|
+
const viewContainsLiveElements = !isSSR || flattenedElements.some(({ props }) => getHydrateDirective(props));
|
|
71
|
+
if (viewContainsLiveElements) {
|
|
72
72
|
// ------ AMD Required module resources
|
|
73
73
|
if (isAMD) {
|
|
74
74
|
// Keep shim format in sync with view_bootstrap.ts
|
|
@@ -161,8 +161,8 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
161
161
|
const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
|
|
162
162
|
// add to the viewRecord
|
|
163
163
|
customElementsRecords.push({ elementName: element, flatGraph: graph });
|
|
164
|
-
// Only process custom elements that are to be hydrated
|
|
165
|
-
if (!isSSR ||
|
|
164
|
+
// Only process custom elements that are to be hydrated or are CSR-only islands
|
|
165
|
+
if (!isSSR || getHydrateDirective(props)) {
|
|
166
166
|
// PRELOAD the custom element module as a link resource
|
|
167
167
|
const specifier = graph.graphs[0].specifier;
|
|
168
168
|
const uri = graph.uriMap[specifier];
|
|
@@ -193,7 +193,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}));
|
|
196
|
-
if (
|
|
196
|
+
if (viewContainsLiveElements) {
|
|
197
197
|
// ADD configuration of the bootstrapModule
|
|
198
198
|
configResources.unshift(getViewBootstrapConfigurationResource({
|
|
199
199
|
id: view.id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { kebabCaseToModuleSpecifier, toImportMetadata, getModuleGraphs, getMappingUriPrefix, GraphDepth, logger, explodeSpecifier, isBundler,
|
|
1
|
+
import { kebabCaseToModuleSpecifier, toImportMetadata, getModuleGraphs, getMappingUriPrefix, GraphDepth, logger, explodeSpecifier, isBundler, getHydrateDirective, } from '@lwrjs/shared-utils';
|
|
2
2
|
import { AppResourceEnum, getAppSpecifier } from '@lwrjs/app-service/identity';
|
|
3
3
|
import { generateHtmlTag, getModuleResourceByUri } from '../utils.js';
|
|
4
4
|
import { flattenCustomElements, getViewBootstrapConfigurationResource, getViewHmrConfigurationResource, } from './utils.js';
|
|
@@ -68,8 +68,8 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
68
68
|
let importMetadata = { imports: {} };
|
|
69
69
|
const customElementsRecords = [];
|
|
70
70
|
const flattenedElements = flattenCustomElements(customElements, isSSR);
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
71
|
+
const viewContainsLiveElements = !isSSR || flattenedElements.some(({ props }) => getHydrateDirective(props));
|
|
72
|
+
if (viewContainsLiveElements) {
|
|
73
73
|
// ------ AMD Required module resources
|
|
74
74
|
if (isAMD) {
|
|
75
75
|
// Keep shim format in sync with legacy_view_bootstrap.ts
|
|
@@ -147,8 +147,8 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
147
147
|
const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
|
|
148
148
|
// add to the viewRecord
|
|
149
149
|
customElementsRecords.push({ elementName: element, flatGraph: graph });
|
|
150
|
-
// Only process custom elements that are to be hydrated
|
|
151
|
-
if (!isSSR ||
|
|
150
|
+
// Only process custom elements that are to be hydrated or are CSR-only islands
|
|
151
|
+
if (!isSSR || getHydrateDirective(props)) {
|
|
152
152
|
// PRELOAD the custom element module as a link resource
|
|
153
153
|
const specifier = graph.graphs[0].specifier;
|
|
154
154
|
const uri = graph.uriMap[specifier];
|
|
@@ -181,7 +181,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
181
181
|
importMetadata = await toImportMetadata(graph, importMetadata, moduleRegistry, runtimeEnvironment, runtimeParams);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
if (
|
|
184
|
+
if (viewContainsLiveElements) {
|
|
185
185
|
// ADD configuration of the bootstrapModule
|
|
186
186
|
configResources.unshift(getViewBootstrapConfigurationResource({
|
|
187
187
|
id: view.id,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.10.0-alpha.
|
|
7
|
+
"version": "0.10.0-alpha.15",
|
|
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.10.0-alpha.
|
|
34
|
-
"@lwrjs/diagnostics": "0.10.0-alpha.
|
|
35
|
-
"@lwrjs/shared-utils": "0.10.0-alpha.
|
|
33
|
+
"@lwrjs/app-service": "0.10.0-alpha.15",
|
|
34
|
+
"@lwrjs/diagnostics": "0.10.0-alpha.15",
|
|
35
|
+
"@lwrjs/shared-utils": "0.10.0-alpha.15"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@lwrjs/types": "0.10.0-alpha.
|
|
38
|
+
"@lwrjs/types": "0.10.0-alpha.15"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=16.0.0 <20"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "70557f63a46167c40cf1415f12af69f78ae402d6"
|
|
44
44
|
}
|