@lwrjs/view-registry 0.15.0-alpha.24 → 0.15.0-alpha.26

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.
@@ -188,7 +188,9 @@ async function getHtmlResources(view, viewParams, resourceContext) {
188
188
  }
189
189
  }
190
190
  await Promise.all(flattenedElements.map(async ({tagName: element, props}) => {
191
- 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);
191
+ const hydrateDirective = (0, import_shared_utils.getHydrateDirective)(props);
192
+ const isSsrOnly = isSSR && !hydrateDirective;
193
+ const graph = await (0, import_shared_utils.getModuleGraphs)((0, import_shared_utils.kebabCaseToModuleSpecifier)(element), {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, {...runtimeParams, ssr: isSsrOnly}, visitedCache);
192
194
  customElementsRecords.push({elementName: element, flatGraph: graph});
193
195
  if (!isSSR || (0, import_shared_utils.getHydrateDirective)(props)) {
194
196
  const specifier = graph.graphs[0].specifier;
@@ -169,7 +169,9 @@ async function getHtmlResources(view, viewParams, resourceContext) {
169
169
  importMetadata = await (0, import_shared_utils.toImportMetadata)(bootstrapModuleGraph, {imports: {}, index: {}}, moduleRegistry, runtimeEnvironment, runtimeParams);
170
170
  }
171
171
  for (const {tagName: element, props} of flattenedElements) {
172
- 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);
172
+ const hydrateDirective = (0, import_shared_utils.getHydrateDirective)(props);
173
+ const isSsrOnly = isSSR && !hydrateDirective;
174
+ const graph = await (0, import_shared_utils.getModuleGraphs)((0, import_shared_utils.kebabCaseToModuleSpecifier)(element), {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, {...runtimeParams, ssr: isSsrOnly}, visitedCache);
173
175
  customElementsRecords.push({elementName: element, flatGraph: graph});
174
176
  if (!isSSR || (0, import_shared_utils.getHydrateDirective)(props)) {
175
177
  const specifier = graph.graphs[0].specifier;
@@ -304,7 +304,7 @@ function generateLinkHeaders(assets, patterns) {
304
304
  const pattern = patterns[i].match;
305
305
  assets.forEach((asset) => {
306
306
  const path = (asset.override?.uri || asset.url).split("?")[0];
307
- if (path.endsWith(pattern)) {
307
+ if (typeof pattern === "string" && path.endsWith(pattern) || typeof pattern === "object" && pattern.some((match) => path.endsWith(match))) {
308
308
  assetConfig[path] = patterns[i].attributes;
309
309
  }
310
310
  });
@@ -213,7 +213,9 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
213
213
  }
214
214
  // ------- View related custom element moduleResources
215
215
  await Promise.all(flattenedElements.map(async ({ tagName: element, props }) => {
216
- const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
216
+ const hydrateDirective = getHydrateDirective(props);
217
+ const isSsrOnly = isSSR && !hydrateDirective;
218
+ const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, { ...runtimeParams, ssr: isSsrOnly }, visitedCache);
217
219
  // add to the viewRecord
218
220
  customElementsRecords.push({ elementName: element, flatGraph: graph });
219
221
  // Only process custom elements that are to be hydrated or are CSR-only islands
@@ -181,8 +181,10 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
181
181
  }
182
182
  // ------- View related custom element moduleResources
183
183
  for (const { tagName: element, props } of flattenedElements) {
184
+ const hydrateDirective = getHydrateDirective(props);
185
+ const isSsrOnly = isSSR && !hydrateDirective;
184
186
  // eslint-disable-next-line no-await-in-loop
185
- const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
187
+ const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, { ...runtimeParams, ssr: isSsrOnly }, visitedCache);
186
188
  // add to the viewRecord
187
189
  customElementsRecords.push({ elementName: element, flatGraph: graph });
188
190
  // Only process custom elements that are to be hydrated or are CSR-only islands
package/build/es/utils.js CHANGED
@@ -293,7 +293,8 @@ export function generateLinkHeaders(assets, patterns) {
293
293
  const pattern = patterns[i].match;
294
294
  assets.forEach((asset) => {
295
295
  const path = (asset.override?.uri || asset.url).split('?')[0];
296
- if (path.endsWith(pattern)) {
296
+ if ((typeof pattern === 'string' && path.endsWith(pattern)) ||
297
+ (typeof pattern === 'object' && pattern.some((match) => path.endsWith(match)))) {
297
298
  assetConfig[path] = patterns[i].attributes;
298
299
  }
299
300
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.24",
7
+ "version": "0.15.0-alpha.26",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -33,17 +33,17 @@
33
33
  "build": "tsc -b"
34
34
  },
35
35
  "dependencies": {
36
- "@lwrjs/app-service": "0.15.0-alpha.24",
37
- "@lwrjs/diagnostics": "0.15.0-alpha.24",
38
- "@lwrjs/instrumentation": "0.15.0-alpha.24",
39
- "@lwrjs/shared-utils": "0.15.0-alpha.24",
36
+ "@lwrjs/app-service": "0.15.0-alpha.26",
37
+ "@lwrjs/diagnostics": "0.15.0-alpha.26",
38
+ "@lwrjs/instrumentation": "0.15.0-alpha.26",
39
+ "@lwrjs/shared-utils": "0.15.0-alpha.26",
40
40
  "lru-cache": "^10.4.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@lwrjs/types": "0.15.0-alpha.24"
43
+ "@lwrjs/types": "0.15.0-alpha.26"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=18.0.0"
47
47
  },
48
- "gitHead": "5fcca470518abd5424d7fbc49d5c3a7281d56356"
48
+ "gitHead": "b73171fb2777cf921935959d60d51750747de343"
49
49
  }