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