@lwrjs/view-registry 0.9.0-alpha.30 → 0.9.0-alpha.32

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.
@@ -85,7 +85,8 @@ async function getHtmlResources(view, viewParams, resourceContext) {
85
85
  requiredResources.push(errorShimDef);
86
86
  }
87
87
  const depth = isAMD ? {static: import_shared_utils.GraphDepth.ALL, dynamic: 1} : {static: import_shared_utils.GraphDepth.NONE, dynamic: 0};
88
- const bootstrapModuleGraph = await (0, import_shared_utils.getModuleGraphs)(bootstrapSpecifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams, visitedCache);
88
+ const defRegistry = bundle ? moduleBundler : moduleRegistry;
89
+ const bootstrapModuleGraph = await (0, import_shared_utils.getModuleGraphs)(bootstrapSpecifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visitedCache);
89
90
  const versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
90
91
  const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
91
92
  moduleResources.push((0, import_utils.getModuleResourceByUri)(uri, runtimeEnvironment, {isPreload: false, isSSR}));
@@ -105,9 +106,13 @@ async function getHtmlResources(view, viewParams, resourceContext) {
105
106
  specifier,
106
107
  version: (0, import_shared_utils.normalizeVersionToUri)(versionedModuleId.version)
107
108
  });
108
- const uri2 = bootstrapModuleGraph.uriMap[versionedModuleSpecifier] || await moduleRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams);
109
+ const uri2 = bootstrapModuleGraph.uriMap[versionedModuleSpecifier] || await defRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams);
109
110
  preloadModuleUris.add(uri2);
110
- preloadAmdModules.push(versionedModuleSpecifier);
111
+ if (versionedModuleId.version == import_shared_utils.VERSION_NOT_PROVIDED) {
112
+ preloadAmdModules.push(specifier);
113
+ } else {
114
+ preloadAmdModules.push(versionedModuleSpecifier);
115
+ }
111
116
  }
112
117
  }
113
118
  if (isAMD) {
@@ -132,7 +137,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
132
137
  const customElementsRecords = [];
133
138
  const flattenedElements = (0, import_utils2.flattenCustomElements)(customElements, isSSR);
134
139
  await Promise.all(flattenedElements.map(async ({tagName: element, props}) => {
135
- const graph = await (0, import_shared_utils.getModuleGraphs)((0, import_shared_utils.kebabCaseToModuleSpecifier)(element), {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
140
+ 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);
136
141
  customElementsRecords.push({elementName: element, flatGraph: graph});
137
142
  const specifier = graph.graphs[0].specifier;
138
143
  const uri2 = graph.uriMap[specifier];
@@ -106,9 +106,13 @@ async function getHtmlResources(view, viewParams, resourceContext) {
106
106
  specifier,
107
107
  version: (0, import_shared_utils.normalizeVersionToUri)(versionedModuleId.version)
108
108
  });
109
- const uri2 = bootstrapModuleGraph.uriMap[versionedModuleSpecifier] || await moduleRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams);
109
+ const uri2 = bootstrapModuleGraph.uriMap[versionedModuleSpecifier] || await defRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams);
110
110
  preloadModuleUris.add(uri2);
111
- preloadAmdModules.push(versionedModuleSpecifier);
111
+ if (versionedModuleId.version == import_shared_utils.VERSION_NOT_PROVIDED) {
112
+ preloadAmdModules.push(specifier);
113
+ } else {
114
+ preloadAmdModules.push(versionedModuleSpecifier);
115
+ }
112
116
  }
113
117
  }
114
118
  if (isAMD) {
@@ -1,4 +1,4 @@
1
- import { kebabCaseToModuleSpecifier, getModuleGraphs, GraphDepth, getModuleUriPrefix, logger, getVersionedModuleId, explodeSpecifier, getSpecifier, normalizeVersionToUri, } from '@lwrjs/shared-utils';
1
+ import { kebabCaseToModuleSpecifier, getModuleGraphs, GraphDepth, getModuleUriPrefix, logger, getVersionedModuleId, explodeSpecifier, getSpecifier, normalizeVersionToUri, VERSION_NOT_PROVIDED, } 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';
@@ -77,7 +77,8 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
77
77
  const depth = isAMD
78
78
  ? { static: GraphDepth.ALL, dynamic: 1 }
79
79
  : { static: GraphDepth.NONE, dynamic: 0 };
80
- const bootstrapModuleGraph = await getModuleGraphs(bootstrapSpecifier, { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams, visitedCache);
80
+ const defRegistry = bundle ? moduleBundler : moduleRegistry;
81
+ const bootstrapModuleGraph = await getModuleGraphs(bootstrapSpecifier, { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visitedCache);
81
82
  // ADD bootstrap module uri as a script resource
82
83
  const versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
83
84
  const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
@@ -105,10 +106,16 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
105
106
  });
106
107
  const uri = bootstrapModuleGraph.uriMap[versionedModuleSpecifier] ||
107
108
  // eslint-disable-next-line no-await-in-loop
108
- (await moduleRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams));
109
+ (await defRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams));
109
110
  preloadModuleUris.add(uri);
110
111
  // in AMD, we also need to tell the loader it's being preloaded
111
- preloadAmdModules.push(versionedModuleSpecifier);
112
+ if (versionedModuleId.version == VERSION_NOT_PROVIDED) {
113
+ // If this is explicitly a non versioned specifier from static metadata key off the non versioned specifier
114
+ preloadAmdModules.push(specifier);
115
+ }
116
+ else {
117
+ preloadAmdModules.push(versionedModuleSpecifier);
118
+ }
112
119
  }
113
120
  }
114
121
  if (isAMD) {
@@ -141,7 +148,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
141
148
  const customElementsRecords = [];
142
149
  const flattenedElements = flattenCustomElements(customElements, isSSR);
143
150
  await Promise.all(flattenedElements.map(async ({ tagName: element, props }) => {
144
- const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
151
+ const graph = await getModuleGraphs(kebabCaseToModuleSpecifier(element), { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams ? runtimeParams : {}, visitedCache);
145
152
  // add to the viewRecord
146
153
  customElementsRecords.push({ elementName: element, flatGraph: graph });
147
154
  // PRELOAD the custom element module as a link resource
@@ -1,4 +1,4 @@
1
- import { kebabCaseToModuleSpecifier, toImportMetadata, getModuleGraphs, getMappingUriPrefix, GraphDepth, logger, getVersionedModuleId, explodeSpecifier, getSpecifier, normalizeVersionToUri, } from '@lwrjs/shared-utils';
1
+ import { kebabCaseToModuleSpecifier, toImportMetadata, getModuleGraphs, getMappingUriPrefix, GraphDepth, logger, getVersionedModuleId, explodeSpecifier, getSpecifier, normalizeVersionToUri, VERSION_NOT_PROVIDED, } 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';
@@ -103,10 +103,16 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
103
103
  });
104
104
  const uri = bootstrapModuleGraph.uriMap[versionedModuleSpecifier] ||
105
105
  // eslint-disable-next-line no-await-in-loop
106
- (await moduleRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams));
106
+ (await defRegistry.resolveModuleUri(versionedModuleId, runtimeEnvironment, runtimeParams));
107
107
  preloadModuleUris.add(uri);
108
108
  // in AMD, we also need to tell the loader it's being preloaded
109
- preloadAmdModules.push(versionedModuleSpecifier);
109
+ if (versionedModuleId.version == VERSION_NOT_PROVIDED) {
110
+ // If this is explicitly a non versioned specifier from static metadata key off the non versioned specifier
111
+ preloadAmdModules.push(specifier);
112
+ }
113
+ else {
114
+ preloadAmdModules.push(versionedModuleSpecifier);
115
+ }
110
116
  }
111
117
  }
112
118
  if (isAMD) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.9.0-alpha.30",
7
+ "version": "0.9.0-alpha.32",
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.30",
34
- "@lwrjs/diagnostics": "0.9.0-alpha.30",
35
- "@lwrjs/shared-utils": "0.9.0-alpha.30"
33
+ "@lwrjs/app-service": "0.9.0-alpha.32",
34
+ "@lwrjs/diagnostics": "0.9.0-alpha.32",
35
+ "@lwrjs/shared-utils": "0.9.0-alpha.32"
36
36
  },
37
37
  "devDependencies": {
38
- "@lwrjs/types": "0.9.0-alpha.30"
38
+ "@lwrjs/types": "0.9.0-alpha.32"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=16.0.0 <20"
42
42
  },
43
- "gitHead": "6e18768b8e47066c41ae0b792bf4aa766b0b784b"
43
+ "gitHead": "50e1f36c99ce2cd1ea8f6f1a2d3cf3967ca45de5"
44
44
  }