@lwrjs/view-registry 0.20.1 → 0.20.3
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.
|
@@ -72,15 +72,15 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
72
72
|
const {specifier} = (0, import_shared_utils.explodeSpecifier)(rawSpecifier);
|
|
73
73
|
if (Object.keys(external).some((e) => specifier === e))
|
|
74
74
|
return;
|
|
75
|
-
const
|
|
76
|
-
if (!
|
|
75
|
+
const preloadUri = uriMap[rawSpecifier];
|
|
76
|
+
if (!preloadUri && (exclude.includes(specifier) || (0, import_shared_utils.isGroupie)(specifier, groups))) {
|
|
77
77
|
import_diagnostics.logger.warn({
|
|
78
78
|
label: "view-registry",
|
|
79
79
|
message: `Skipping preload of unknown static import: ${rawSpecifier}`
|
|
80
80
|
});
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return preloadUri;
|
|
84
84
|
};
|
|
85
85
|
const {
|
|
86
86
|
id: appName,
|
|
@@ -171,18 +171,24 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
171
171
|
resources: configResources
|
|
172
172
|
};
|
|
173
173
|
versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
|
|
174
|
-
const
|
|
175
|
-
if (!
|
|
174
|
+
const bootstrapUri = bootstrapModuleGraph.uriMap[versionedSpecifier];
|
|
175
|
+
if (!bootstrapUri) {
|
|
176
176
|
throw Error(`Invalid Module Resource ${versionedSpecifier}`);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
179
|
-
|
|
178
|
+
const bootstrapBundleDef = (0, import_utils2.getBundleDefinition)(bootstrapModuleGraph, versionedSpecifier);
|
|
179
|
+
const bootstrapIntegrity = bootstrapBundleDef?.integrity;
|
|
180
|
+
moduleResources.push((0, import_utils.getModuleResourceByUri)(bootstrapUri, runtimeEnvironment, {
|
|
181
|
+
integrity: bootstrapIntegrity,
|
|
182
|
+
isPreload: false,
|
|
183
|
+
isSSR,
|
|
184
|
+
nonce
|
|
185
|
+
}));
|
|
180
186
|
for (const depSpecifier of bootstrapModuleGraph.graphs[0].static) {
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
(0, import_preload_utils.setPreloadModulesMeta)(depSpecifier,
|
|
187
|
+
const bootstrapDepUri = getPreloadUri(depSpecifier, bootstrapModuleGraph.uriMap);
|
|
188
|
+
if (bootstrapDepUri) {
|
|
189
|
+
const bootstrapDepIntegrity = (0, import_utils2.getBundleIntegrity)(bootstrapModuleGraph, depSpecifier);
|
|
190
|
+
const bootstrapDepDef = bootstrapModuleGraph.linkedDefinitions[depSpecifier];
|
|
191
|
+
(0, import_preload_utils.setPreloadModulesMeta)(depSpecifier, bootstrapDepUri, bootstrapDepIntegrity, groups, viewPreloads, bootstrapDepDef?.bundleRecord?.includedModules);
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
if ((0, import_shared_utils.isBundler)(defRegistry)) {
|
|
@@ -192,20 +198,25 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
192
198
|
}
|
|
193
199
|
if (isAMD) {
|
|
194
200
|
requiredAmdModules.push(versionedSpecifier);
|
|
195
|
-
imports[versionedSpecifier] =
|
|
201
|
+
imports[versionedSpecifier] = bootstrapUri;
|
|
202
|
+
addIncludedModulesToImports(bootstrapBundleDef, imports, bootstrapUri);
|
|
196
203
|
const levels = (0, import_shared_utils.isMrtBundle)() ? bootstrapModuleGraph.graphs.length : 1;
|
|
197
204
|
for (let i = 0; i < levels; i++) {
|
|
198
205
|
for (const staticDep of bootstrapModuleGraph.graphs[i].static) {
|
|
199
|
-
const
|
|
200
|
-
|
|
206
|
+
const staticDepUri = bootstrapModuleGraph.uriMap[staticDep];
|
|
207
|
+
const staticBundleDef = (0, import_utils2.getBundleDefinition)(bootstrapModuleGraph, staticDep);
|
|
208
|
+
imports[staticDep] = staticDepUri;
|
|
209
|
+
addIncludedModulesToImports(staticBundleDef, imports, staticDepUri);
|
|
201
210
|
if (services?.length && i === 0) {
|
|
202
211
|
requiredAmdModules.push(staticDep);
|
|
203
212
|
}
|
|
204
213
|
}
|
|
205
214
|
for (const dynamicDep of bootstrapModuleGraph.graphs[i].dynamicRefs) {
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
|
|
215
|
+
const dynamicDepUri = bootstrapModuleGraph.uriMap[dynamicDep];
|
|
216
|
+
if (dynamicDepUri) {
|
|
217
|
+
const dynamicBundleDef = (0, import_utils2.getBundleDefinition)(bootstrapModuleGraph, dynamicDep);
|
|
218
|
+
imports[dynamicDep] = dynamicDepUri;
|
|
219
|
+
addIncludedModulesToImports(dynamicBundleDef, imports, dynamicDepUri);
|
|
209
220
|
} else {
|
|
210
221
|
import_diagnostics.logger.warn({
|
|
211
222
|
label: `view-registry`,
|
|
@@ -234,33 +245,38 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
234
245
|
customElementsRecords.push({elementName: element, flatGraph: graph});
|
|
235
246
|
if (!isSSR || (0, import_shared_utils.getHydrateDirective)(props)) {
|
|
236
247
|
const specifier = graph.graphs[0].specifier;
|
|
237
|
-
const
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const includedModules =
|
|
241
|
-
(0, import_preload_utils.setPreloadModulesMeta)(specifier,
|
|
248
|
+
const elementUri = graph.uriMap[specifier];
|
|
249
|
+
const elementIntegrity = (0, import_utils2.getBundleIntegrity)(graph, specifier);
|
|
250
|
+
const elementBundleDef = graph.linkedDefinitions[specifier];
|
|
251
|
+
const includedModules = elementBundleDef?.bundleRecord ? elementBundleDef.bundleRecord.includedModules : [];
|
|
252
|
+
(0, import_preload_utils.setPreloadModulesMeta)(specifier, elementUri, elementIntegrity, groups, viewPreloads, includedModules);
|
|
242
253
|
if (bundle) {
|
|
243
254
|
for (const depSpecifier of graph.graphs[0].static) {
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
(0, import_preload_utils.setPreloadModulesMeta)(depSpecifier,
|
|
255
|
+
const elementDepUri = getPreloadUri(depSpecifier, graph.uriMap);
|
|
256
|
+
if (elementDepUri) {
|
|
257
|
+
const elementDepIntegrity = (0, import_utils2.getBundleIntegrity)(graph, depSpecifier);
|
|
258
|
+
const elementDepDef = graph.linkedDefinitions[depSpecifier];
|
|
259
|
+
(0, import_preload_utils.setPreloadModulesMeta)(depSpecifier, elementDepUri, elementDepIntegrity, groups, viewPreloads, elementDepDef?.bundleRecord?.includedModules);
|
|
249
260
|
}
|
|
250
261
|
}
|
|
251
262
|
}
|
|
252
263
|
rootComponents.push(specifier);
|
|
253
|
-
imports[specifier] =
|
|
264
|
+
imports[specifier] = elementUri;
|
|
265
|
+
addIncludedModulesToImports(elementBundleDef, imports, elementUri);
|
|
254
266
|
if (isAMD) {
|
|
255
267
|
const levels = (0, import_shared_utils.isMrtBundle)() ? graph.graphs.length : 1;
|
|
256
268
|
for (let i = 0; i < levels; i++) {
|
|
257
269
|
for (const staticDep of graph.graphs[i].static) {
|
|
258
|
-
const
|
|
259
|
-
|
|
270
|
+
const elementStaticDepUri = graph.uriMap[staticDep];
|
|
271
|
+
const elementStaticBundleDef = (0, import_utils2.getBundleDefinition)(graph, staticDep);
|
|
272
|
+
imports[staticDep] = elementStaticDepUri;
|
|
273
|
+
addIncludedModulesToImports(elementStaticBundleDef, imports, elementStaticDepUri);
|
|
260
274
|
}
|
|
261
275
|
for (const dynamicDep of graph.graphs[i].dynamicRefs) {
|
|
262
|
-
const
|
|
263
|
-
|
|
276
|
+
const elementDynamicDepUri = graph.uriMap[dynamicDep];
|
|
277
|
+
const elementDynamicBundleDef = (0, import_utils2.getBundleDefinition)(graph, dynamicDep);
|
|
278
|
+
imports[dynamicDep] = elementDynamicDepUri;
|
|
279
|
+
addIncludedModulesToImports(elementDynamicBundleDef, imports, elementDynamicDepUri);
|
|
264
280
|
}
|
|
265
281
|
}
|
|
266
282
|
}
|
|
@@ -300,9 +316,9 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
300
316
|
}
|
|
301
317
|
const dedupedUris = [...new Set(viewPreloads.uris)];
|
|
302
318
|
for (const preloadUri of dedupedUris) {
|
|
303
|
-
const
|
|
319
|
+
const preloadIntegrity = viewPreloads.integrities.get(preloadUri);
|
|
304
320
|
moduleResources.push((0, import_utils.getModuleResourceByUri)(preloadUri, runtimeEnvironment, {
|
|
305
|
-
integrity,
|
|
321
|
+
integrity: preloadIntegrity,
|
|
306
322
|
isPreload: true,
|
|
307
323
|
isSSR,
|
|
308
324
|
nonce
|
|
@@ -319,3 +335,12 @@ async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
319
335
|
}
|
|
320
336
|
};
|
|
321
337
|
}
|
|
338
|
+
function addIncludedModulesToImports(bundleDef, imports, uri) {
|
|
339
|
+
if ((0, import_shared_utils.isMrtBundle)()) {
|
|
340
|
+
bundleDef?.bundleRecord?.includedModules?.forEach((module2) => {
|
|
341
|
+
if (!imports[module2]) {
|
|
342
|
+
imports[module2] = uri;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
@@ -25,6 +25,7 @@ var __toModule = (module2) => {
|
|
|
25
25
|
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
flattenCustomElements: () => flattenCustomElements,
|
|
28
|
+
getBundleDefinition: () => getBundleDefinition,
|
|
28
29
|
getBundleIntegrity: () => getBundleIntegrity,
|
|
29
30
|
getViewBootstrapConfigurationResource: () => getViewBootstrapConfigurationResource,
|
|
30
31
|
getViewHmrConfigurationResource: () => getViewHmrConfigurationResource
|
|
@@ -141,3 +142,6 @@ function getBundleIntegrity(bootstrapModuleGraph, versionedSpecifier) {
|
|
|
141
142
|
const integrity = def?.integrity;
|
|
142
143
|
return integrity;
|
|
143
144
|
}
|
|
145
|
+
function getBundleDefinition(bootstrapModuleGraph, versionedSpecifier) {
|
|
146
|
+
return bootstrapModuleGraph.linkedDefinitions[versionedSpecifier];
|
|
147
|
+
}
|
|
@@ -2,7 +2,7 @@ import { logger } from '@lwrjs/diagnostics';
|
|
|
2
2
|
import { kebabCaseToModuleSpecifier, getModuleGraphs, GraphDepth, getModuleUriPrefix, explodeSpecifier, isBundler, getHydrateDirective, isGroupie, isExternalSpecifier, isLocalDev, isLambdaEnv, isMrtBundle, } from '@lwrjs/shared-utils';
|
|
3
3
|
import { AppResourceEnum, getAppSpecifier } from '@lwrjs/app-service/identity';
|
|
4
4
|
import { addExternalScriptNonce, generateHtmlTag, getModuleResource, getModuleResourceByUri, getViewNonce, getModuleGraphCacheKey, } from '../utils.js';
|
|
5
|
-
import { flattenCustomElements, getBundleIntegrity, getViewBootstrapConfigurationResource, getViewHmrConfigurationResource, } from './utils.js';
|
|
5
|
+
import { flattenCustomElements, getBundleDefinition, getBundleIntegrity, getViewBootstrapConfigurationResource, getViewHmrConfigurationResource, } from './utils.js';
|
|
6
6
|
import { setPreloadModulesMeta, getPreloadModulesMeta, getPreloadModuleList, } from './preload-utils.js';
|
|
7
7
|
import { LRUCache } from 'lru-cache';
|
|
8
8
|
function includeIdFactory(bundleConfig) {
|
|
@@ -45,10 +45,10 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
45
45
|
// do not preload externals; this is the app's responsibility
|
|
46
46
|
if (Object.keys(external).some((e) => specifier === e))
|
|
47
47
|
return;
|
|
48
|
-
const
|
|
48
|
+
const preloadUri = uriMap[rawSpecifier];
|
|
49
49
|
// if there is no uri for an exclude or groupie, they've been handled via another specifier
|
|
50
50
|
// eg: if a bundle group has already been added to the URI map, its groups will not also be added
|
|
51
|
-
if (!
|
|
51
|
+
if (!preloadUri && (exclude.includes(specifier) || isGroupie(specifier, groups))) {
|
|
52
52
|
// warn instead of throwing from setPreloadModulesMeta()
|
|
53
53
|
logger.warn({
|
|
54
54
|
label: 'view-registry',
|
|
@@ -56,7 +56,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
56
56
|
});
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return preloadUri;
|
|
60
60
|
};
|
|
61
61
|
const { id: appName, bootstrap: { services, module: bootstrapModule, preloadModules = [] } = {
|
|
62
62
|
services: [],
|
|
@@ -190,20 +190,26 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
190
190
|
};
|
|
191
191
|
// ADD bootstrap module uri as a script resource
|
|
192
192
|
versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
|
|
193
|
-
const
|
|
193
|
+
const bootstrapUri = bootstrapModuleGraph.uriMap[versionedSpecifier];
|
|
194
194
|
// Throw a very specific error if we get this back and the uri property is not set
|
|
195
|
-
if (!
|
|
195
|
+
if (!bootstrapUri) {
|
|
196
196
|
throw Error(`Invalid Module Resource ${versionedSpecifier}`);
|
|
197
197
|
}
|
|
198
|
-
const
|
|
199
|
-
|
|
198
|
+
const bootstrapBundleDef = getBundleDefinition(bootstrapModuleGraph, versionedSpecifier);
|
|
199
|
+
const bootstrapIntegrity = bootstrapBundleDef?.integrity;
|
|
200
|
+
moduleResources.push(getModuleResourceByUri(bootstrapUri, runtimeEnvironment, {
|
|
201
|
+
integrity: bootstrapIntegrity,
|
|
202
|
+
isPreload: false,
|
|
203
|
+
isSSR,
|
|
204
|
+
nonce,
|
|
205
|
+
}));
|
|
200
206
|
// PRELOAD the bootstrap module static dependencies as preloaded script resources
|
|
201
207
|
for (const depSpecifier of bootstrapModuleGraph.graphs[0].static) {
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
setPreloadModulesMeta(depSpecifier,
|
|
208
|
+
const bootstrapDepUri = getPreloadUri(depSpecifier, bootstrapModuleGraph.uriMap);
|
|
209
|
+
if (bootstrapDepUri) {
|
|
210
|
+
const bootstrapDepIntegrity = getBundleIntegrity(bootstrapModuleGraph, depSpecifier);
|
|
211
|
+
const bootstrapDepDef = bootstrapModuleGraph.linkedDefinitions[depSpecifier];
|
|
212
|
+
setPreloadModulesMeta(depSpecifier, bootstrapDepUri, bootstrapDepIntegrity, groups, viewPreloads, bootstrapDepDef?.bundleRecord?.includedModules);
|
|
207
213
|
}
|
|
208
214
|
}
|
|
209
215
|
// PRELOAD configured preloadModules as preloaded script resources
|
|
@@ -217,14 +223,19 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
217
223
|
// ADD bootstrap module as required
|
|
218
224
|
requiredAmdModules.push(versionedSpecifier);
|
|
219
225
|
// AMD ADD bootstrap module uri addressability
|
|
220
|
-
imports[versionedSpecifier] =
|
|
226
|
+
imports[versionedSpecifier] = bootstrapUri;
|
|
227
|
+
// Add included modules to imports if not already present
|
|
228
|
+
addIncludedModulesToImports(bootstrapBundleDef, imports, bootstrapUri);
|
|
221
229
|
const levels = isMrtBundle() ? bootstrapModuleGraph.graphs.length : 1;
|
|
222
230
|
for (let i = 0; i < levels; i++) {
|
|
223
231
|
// PRELOAD bootstrap module static deps as link resource
|
|
224
232
|
for (const staticDep of bootstrapModuleGraph.graphs[i].static) {
|
|
225
|
-
const
|
|
233
|
+
const staticDepUri = bootstrapModuleGraph.uriMap[staticDep];
|
|
234
|
+
const staticBundleDef = getBundleDefinition(bootstrapModuleGraph, staticDep);
|
|
226
235
|
// AMD ADD static module dep uri addressability
|
|
227
|
-
imports[staticDep] =
|
|
236
|
+
imports[staticDep] = staticDepUri;
|
|
237
|
+
// Add included modules to imports if not already present
|
|
238
|
+
addIncludedModulesToImports(staticBundleDef, imports, staticDepUri);
|
|
228
239
|
// ADD bootstrap module static deps to requiredAmdModules if services, otherwise preloadModules
|
|
229
240
|
if (services?.length && i === 0) {
|
|
230
241
|
requiredAmdModules.push(staticDep);
|
|
@@ -232,9 +243,12 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
232
243
|
}
|
|
233
244
|
// AMD Add import mappings for known dynamic imports
|
|
234
245
|
for (const dynamicDep of bootstrapModuleGraph.graphs[i].dynamicRefs) {
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
|
|
246
|
+
const dynamicDepUri = bootstrapModuleGraph.uriMap[dynamicDep];
|
|
247
|
+
if (dynamicDepUri) {
|
|
248
|
+
const dynamicBundleDef = getBundleDefinition(bootstrapModuleGraph, dynamicDep);
|
|
249
|
+
imports[dynamicDep] = dynamicDepUri;
|
|
250
|
+
// Add included modules to imports if not already present
|
|
251
|
+
addIncludedModulesToImports(dynamicBundleDef, imports, dynamicDepUri);
|
|
238
252
|
}
|
|
239
253
|
else {
|
|
240
254
|
logger.warn({
|
|
@@ -269,37 +283,47 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
269
283
|
if (!isSSR || getHydrateDirective(props)) {
|
|
270
284
|
// PRELOAD the custom element module as a link resource
|
|
271
285
|
const specifier = graph.graphs[0].specifier;
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
const includedModules =
|
|
276
|
-
|
|
286
|
+
const elementUri = graph.uriMap[specifier];
|
|
287
|
+
const elementIntegrity = getBundleIntegrity(graph, specifier);
|
|
288
|
+
const elementBundleDef = graph.linkedDefinitions[specifier];
|
|
289
|
+
const includedModules = elementBundleDef?.bundleRecord
|
|
290
|
+
? elementBundleDef.bundleRecord.includedModules
|
|
291
|
+
: [];
|
|
292
|
+
setPreloadModulesMeta(specifier, elementUri, elementIntegrity, groups, viewPreloads, includedModules);
|
|
277
293
|
// PRELOAD custom element static deps as link resources when bundling is ON
|
|
278
294
|
if (bundle) {
|
|
279
295
|
for (const depSpecifier of graph.graphs[0].static) {
|
|
280
|
-
const
|
|
281
|
-
if (
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
setPreloadModulesMeta(depSpecifier,
|
|
296
|
+
const elementDepUri = getPreloadUri(depSpecifier, graph.uriMap);
|
|
297
|
+
if (elementDepUri) {
|
|
298
|
+
const elementDepIntegrity = getBundleIntegrity(graph, depSpecifier);
|
|
299
|
+
const elementDepDef = graph.linkedDefinitions[depSpecifier];
|
|
300
|
+
setPreloadModulesMeta(depSpecifier, elementDepUri, elementDepIntegrity, groups, viewPreloads, elementDepDef?.bundleRecord?.includedModules);
|
|
285
301
|
}
|
|
286
302
|
}
|
|
287
303
|
}
|
|
288
304
|
// ADD register custom elements as a uri addressable rootComponents
|
|
289
305
|
rootComponents.push(specifier);
|
|
290
|
-
imports[specifier] =
|
|
306
|
+
imports[specifier] = elementUri;
|
|
307
|
+
// Add included modules to imports if not already present
|
|
308
|
+
addIncludedModulesToImports(elementBundleDef, imports, elementUri);
|
|
291
309
|
if (isAMD) {
|
|
292
310
|
const levels = isMrtBundle() ? graph.graphs.length : 1;
|
|
293
311
|
for (let i = 0; i < levels; i++) {
|
|
294
312
|
for (const staticDep of graph.graphs[i].static) {
|
|
295
|
-
const
|
|
313
|
+
const elementStaticDepUri = graph.uriMap[staticDep];
|
|
314
|
+
const elementStaticBundleDef = getBundleDefinition(graph, staticDep);
|
|
296
315
|
// AMD ADD static module dep uri addressability
|
|
297
|
-
imports[staticDep] =
|
|
316
|
+
imports[staticDep] = elementStaticDepUri;
|
|
317
|
+
// Add included modules to imports if not already present
|
|
318
|
+
addIncludedModulesToImports(elementStaticBundleDef, imports, elementStaticDepUri);
|
|
298
319
|
}
|
|
299
320
|
// AMD ADD dynamic imports module dep uri addressability
|
|
300
321
|
for (const dynamicDep of graph.graphs[i].dynamicRefs) {
|
|
301
|
-
const
|
|
302
|
-
|
|
322
|
+
const elementDynamicDepUri = graph.uriMap[dynamicDep];
|
|
323
|
+
const elementDynamicBundleDef = getBundleDefinition(graph, dynamicDep);
|
|
324
|
+
imports[dynamicDep] = elementDynamicDepUri;
|
|
325
|
+
// Add included modules to imports if not already present
|
|
326
|
+
addIncludedModulesToImports(elementDynamicBundleDef, imports, elementDynamicDepUri);
|
|
303
327
|
}
|
|
304
328
|
}
|
|
305
329
|
}
|
|
@@ -343,9 +367,9 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
343
367
|
const dedupedUris = [...new Set(viewPreloads.uris)];
|
|
344
368
|
// PRELOAD script resources for preload module URIs after the bootstrap module
|
|
345
369
|
for (const preloadUri of dedupedUris) {
|
|
346
|
-
const
|
|
370
|
+
const preloadIntegrity = viewPreloads.integrities.get(preloadUri);
|
|
347
371
|
moduleResources.push(getModuleResourceByUri(preloadUri, runtimeEnvironment, {
|
|
348
|
-
integrity,
|
|
372
|
+
integrity: preloadIntegrity,
|
|
349
373
|
isPreload: true,
|
|
350
374
|
isSSR,
|
|
351
375
|
nonce,
|
|
@@ -363,4 +387,14 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
|
363
387
|
},
|
|
364
388
|
};
|
|
365
389
|
}
|
|
390
|
+
// Add included modules to imports if not already present
|
|
391
|
+
function addIncludedModulesToImports(bundleDef, imports, uri) {
|
|
392
|
+
if (isMrtBundle()) {
|
|
393
|
+
bundleDef?.bundleRecord?.includedModules?.forEach((module) => {
|
|
394
|
+
if (!imports[module]) {
|
|
395
|
+
imports[module] = uri;
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
366
400
|
//# sourceMappingURL=legacy_view_bootstrap.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ClientBootstrapConfig, RuntimeEnvironment, RuntimeParams, ResourceDefinition, RenderedViewMetadata, CustomElementReference, View, ViewInfo, FlattenedModuleGraphs } from '@lwrjs/types';
|
|
1
|
+
import type { ClientBootstrapConfig, RuntimeEnvironment, RuntimeParams, ResourceDefinition, RenderedViewMetadata, CustomElementReference, View, ViewInfo, FlattenedModuleGraphs, BundleDefinition } from '@lwrjs/types';
|
|
2
2
|
export declare function getViewBootstrapConfigurationResource(viewInfo: ViewInfo, config: ClientBootstrapConfig, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams, warnings?: (Error | string)[]): ResourceDefinition;
|
|
3
3
|
export declare function getViewHmrConfigurationResource(view: View, viewMetadata: RenderedViewMetadata): ResourceDefinition;
|
|
4
4
|
export declare function flattenCustomElements(arr: CustomElementReference[], isSSR?: boolean): CustomElementReference[];
|
|
5
5
|
export declare function getBundleIntegrity(bootstrapModuleGraph: FlattenedModuleGraphs, versionedSpecifier: string): string | undefined;
|
|
6
|
+
export declare function getBundleDefinition(bootstrapModuleGraph: FlattenedModuleGraphs, versionedSpecifier: string): BundleDefinition | undefined;
|
|
6
7
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -126,4 +126,7 @@ export function getBundleIntegrity(bootstrapModuleGraph, versionedSpecifier) {
|
|
|
126
126
|
const integrity = def?.integrity;
|
|
127
127
|
return integrity;
|
|
128
128
|
}
|
|
129
|
+
export function getBundleDefinition(bootstrapModuleGraph, versionedSpecifier) {
|
|
130
|
+
return bootstrapModuleGraph.linkedDefinitions[versionedSpecifier];
|
|
131
|
+
}
|
|
129
132
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.20.
|
|
7
|
+
"version": "0.20.3",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.20.
|
|
37
|
-
"@lwrjs/config": "0.20.
|
|
38
|
-
"@lwrjs/diagnostics": "0.20.
|
|
39
|
-
"@lwrjs/instrumentation": "0.20.
|
|
40
|
-
"@lwrjs/shared-utils": "0.20.
|
|
36
|
+
"@lwrjs/app-service": "0.20.3",
|
|
37
|
+
"@lwrjs/config": "0.20.3",
|
|
38
|
+
"@lwrjs/diagnostics": "0.20.3",
|
|
39
|
+
"@lwrjs/instrumentation": "0.20.3",
|
|
40
|
+
"@lwrjs/shared-utils": "0.20.3",
|
|
41
41
|
"lru-cache": "^10.4.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@lwrjs/types": "0.20.
|
|
44
|
+
"@lwrjs/types": "0.20.3"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=20.0.0"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"volta": {
|
|
50
50
|
"extends": "../../../package.json"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "54759076bcb5d09e143a620e7653e2494658aefb"
|
|
53
53
|
}
|