@lwrjs/core 0.9.0-alpha.24 → 0.9.0-alpha.27

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.
@@ -29,6 +29,7 @@ __export(exports, {
29
29
  var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
30
30
  function createProviderContext(serverContext) {
31
31
  const {
32
+ assets,
32
33
  cacheDir,
33
34
  lwc: {modules = []},
34
35
  routes,
@@ -64,6 +65,7 @@ function createProviderContext(serverContext) {
64
65
  viewRegistry: serverContext.viewRegistry.getPublicApi(),
65
66
  assetRegistry: serverContext.assetRegistry.getPublicApi(),
66
67
  config: (0, import_shared_utils.deepFreeze)({
68
+ assets,
67
69
  cacheDir,
68
70
  modules,
69
71
  routes,
@@ -36,10 +36,19 @@ function createAssetMiddleware(context) {
36
36
  } = context;
37
37
  return async (req, res) => {
38
38
  const {runtimeEnvironment} = req.getRuntimeContext(context.runtimeEnvironment);
39
- const {assetId, signature} = (0, import_identity.getAssetIdentity)(req);
39
+ const {assetId, immutable, signature} = (0, import_identity.getAssetIdentity)(req);
40
40
  if (basePath && !assetId.specifier.startsWith(basePath)) {
41
41
  assetId.specifier = import_path.default.join(basePath, assetId.specifier);
42
42
  }
43
+ const assetUri = await assetRegistry.resolveAssetUri(assetId, runtimeEnvironment);
44
+ if (assetUri.external) {
45
+ res.set({
46
+ Location: assetUri.uri,
47
+ "cache-control": "public, max-age=60"
48
+ });
49
+ res.sendStatus(302);
50
+ return;
51
+ }
43
52
  const asset = await assetRegistry.getAsset({...assetId, signature}, runtimeEnvironment, req.isSiteGeneration());
44
53
  if (req.isSiteGeneration()) {
45
54
  res.setSiteGenerationMetadata({asset});
@@ -47,6 +56,11 @@ function createAssetMiddleware(context) {
47
56
  if (asset.mime) {
48
57
  res.type(asset.mime);
49
58
  }
59
+ if (runtimeEnvironment.immutableAssets && immutable) {
60
+ res.setHeader("Cache-control", "public, max-age=12895706, immutable");
61
+ } else if (runtimeEnvironment.immutableAssets) {
62
+ res.setHeader("Cache-control", "public, max-age=60");
63
+ }
50
64
  res.status(200).stream(asset.stream());
51
65
  };
52
66
  }
@@ -76,14 +76,13 @@ function getResourceIdentity(req) {
76
76
  function getAssetIdentity(req) {
77
77
  const {signature, immutable, assetType: type} = req.params;
78
78
  const specifier = signature && type ? "/" + req.params[0] : req.originalUrl.split("?")[0];
79
- if (immutable) {
80
- }
81
79
  if (validateSpecifier(specifier) === false) {
82
80
  throw (0, import_diagnostics.createSingleDiagnosticError)({
83
81
  description: import_diagnostics.descriptions.UNRESOLVABLE.INVALID_SPECIFIER(specifier)
84
82
  }, import_diagnostics.LwrUnresolvableError);
85
83
  }
86
84
  return {
85
+ immutable,
87
86
  assetId: {
88
87
  specifier,
89
88
  type
@@ -57,7 +57,7 @@ var SiteGenerator = class {
57
57
  const runtimeEnvironment = (0, import_config.getRuntimeEnvironment)(config);
58
58
  await this.generateRoutes(runtimeEnvironment, staticSiteGenerator, routes, basePath, dispatcher, outputDir, urlRewriteMap);
59
59
  this.writeNetlifyRedirectConfig(outputDir, urlRewriteMap);
60
- this.copyAssets(assets, outputDir, basePath);
60
+ await this.copyAssets(assets, outputDir, config);
61
61
  const endTime = import_perf_hooks.performance.now();
62
62
  const timeDiff = (endTime - startTime) / 1e3;
63
63
  import_shared_utils.logger.info(`[SSG] Static Site Generation complete in ${Math.round(timeDiff)} seconds`);
@@ -215,20 +215,24 @@ var SiteGenerator = class {
215
215
  mimeType: String(assetDefinition.mime)
216
216
  };
217
217
  const siteAssets = siteConfig.siteMetadata.getSiteAssets();
218
- siteAssets.assets[specifier] = resourceMetadata;
218
+ if (!siteAssets.assets[specifier]) {
219
+ siteAssets.assets[specifier] = resourceMetadata;
220
+ } else {
221
+ import_shared_utils.logger.debug(`[SSG] Ignore asset redefinition ${specifier}`);
222
+ }
219
223
  }
220
224
  }
221
225
  }
222
226
  async handleMappingResource(url, context, siteConfig, dispatcher) {
223
- const {importMetadata: importMetatdata} = siteConfig;
227
+ const {importMetadata} = siteConfig;
224
228
  const statusCode = context.response?.status;
225
229
  if (statusCode === 200) {
226
230
  const newImportMetadata = context.fs?.body;
227
231
  let filteredImportMetadata;
228
- if (!importMetatdata) {
232
+ if (!importMetadata) {
229
233
  filteredImportMetadata = newImportMetadata;
230
234
  } else {
231
- filteredImportMetadata = importMetatdata.addAdditionalMetadata(newImportMetadata);
235
+ filteredImportMetadata = importMetadata.addAdditionalMetadata(newImportMetadata);
232
236
  }
233
237
  const dispatchRequests = [];
234
238
  for (const uri of Object.keys(filteredImportMetadata.imports)) {
@@ -380,20 +384,65 @@ var SiteGenerator = class {
380
384
  });
381
385
  import_fs_extra.default.writeFileSync(serveJsonPath, JSON.stringify({rewrites, directoryListing: false, renderSingle: true}, null, 1));
382
386
  }
383
- copyAssets(assets, outputDir, basePath) {
387
+ async copyAssets(assets, outputDir, config) {
388
+ const {basePath} = config;
389
+ const runtimeEnvironment = (0, import_config.getRuntimeEnvironment)(config);
390
+ const siteConfig = this.createSiteConfig(outputDir, "en-US", new Map(), true, runtimeEnvironment);
384
391
  for (const asset of assets) {
385
392
  try {
386
- const assetSrcDir = asset.dir || asset.file;
387
- const assetOutputDir = (0, import_path.join)(outputDir, basePath ? basePath + asset.urlPath : asset.urlPath);
393
+ const assetSrcFile = asset.file;
394
+ const assetSrcDir = asset.dir;
395
+ const assetsPath = (0, import_path.join)(outputDir, basePath ? basePath + asset.urlPath : asset.urlPath);
388
396
  if (assetSrcDir && import_fs_extra.default.existsSync(assetSrcDir)) {
389
- import_fs_extra.default.copySync(assetSrcDir, assetOutputDir);
397
+ import_fs_extra.default.copySync(assetSrcDir, assetsPath);
398
+ this.addAssetsToMetadata(assetsPath, siteConfig);
399
+ } else if (assetSrcFile && import_fs_extra.default.existsSync(assetSrcFile)) {
400
+ import_fs_extra.default.copySync(assetSrcFile, assetsPath);
401
+ this.addAssetToMetadata(assetsPath, siteConfig);
390
402
  } else {
391
- import_shared_utils.logger.warn("[SSG] Could not find assets to copy at path: " + assetSrcDir);
403
+ import_shared_utils.logger.warn("[SSG] Could not find assets to copy at path: " + assetsPath);
392
404
  }
393
405
  } catch (e) {
394
406
  import_shared_utils.logger.error("[SSG] Error occurred processing asset config: " + JSON.stringify(asset), e);
395
407
  }
396
408
  }
409
+ await siteConfig.siteMetadata?.persistSiteMetadata();
410
+ }
411
+ addAssetsToMetadata(directoryPath, siteConfig) {
412
+ try {
413
+ const files = import_fs_extra.default.readdirSync(directoryPath);
414
+ for (const file of files) {
415
+ const filePath = (0, import_path.join)(directoryPath, file);
416
+ if (import_fs_extra.default.statSync(filePath).isDirectory()) {
417
+ this.addAssetsToMetadata(filePath, siteConfig);
418
+ } else {
419
+ this.addAssetToMetadata(filePath, siteConfig);
420
+ }
421
+ }
422
+ } catch (err) {
423
+ import_shared_utils.logger.warn(`[SSG] Unexpected error collecting asset directory metadata for ${directoryPath}`, err);
424
+ }
425
+ }
426
+ addAssetToMetadata(filePath, siteConfig) {
427
+ try {
428
+ const uri = encodeURI((0, import_path.normalize)(filePath).replace(siteConfig.outputDir, ""));
429
+ this.addAssetToSiteMetadata({
430
+ uri,
431
+ type: "asset",
432
+ stream: function(encoding) {
433
+ throw new Error("Function not implemented.");
434
+ },
435
+ entry: filePath,
436
+ ext: (0, import_path.extname)(filePath),
437
+ mime: (0, import_shared_utils.mimeLookup)(filePath),
438
+ ownHash: "not-provided",
439
+ content: function(encoding) {
440
+ throw new Error("Function not implemented.");
441
+ }
442
+ }, uri, siteConfig);
443
+ } catch (err) {
444
+ import_shared_utils.logger.warn(`[SSG] Unexpected error collecting asset metadata for ${filePath}`, err);
445
+ }
397
446
  }
398
447
  createSiteConfig(outputDir, locale, urlRewriteMap, skipBaseDocumentGeneration, runtimeEnvironment) {
399
448
  const featureFlags = this.filterFeatureFlags();
@@ -418,13 +467,13 @@ var SiteGenerator = class {
418
467
  filterFeatureFlags() {
419
468
  const ffs = (0, import_shared_utils.getFeatureFlags)();
420
469
  if (ffs && Object.keys(ffs).length) {
421
- const accumlator = {};
470
+ const accumulator = {};
422
471
  for (const [key, value] of Object.entries(ffs)) {
423
472
  if (value) {
424
- accumlator[key] = true;
473
+ accumulator[key] = true;
425
474
  }
426
475
  }
427
- return {featureFlags: accumlator};
476
+ return {featureFlags: accumulator};
428
477
  } else {
429
478
  return void 0;
430
479
  }
@@ -492,10 +541,10 @@ var ViewImportMetadataImpl = class {
492
541
  index
493
542
  };
494
543
  }
495
- mergeImportMetadata(targetImportMetdadata, newImportMetadata) {
496
- Object.assign(targetImportMetdadata.imports, newImportMetadata.imports);
497
- if (targetImportMetdadata.index) {
498
- Object.assign(targetImportMetdadata.index, newImportMetadata.index || {});
544
+ mergeImportMetadata(targetImportMetadata, newImportMetadata) {
545
+ Object.assign(targetImportMetadata.imports, newImportMetadata.imports);
546
+ if (targetImportMetadata.index) {
547
+ Object.assign(targetImportMetadata.index, newImportMetadata.index || {});
499
548
  }
500
549
  }
501
550
  };
@@ -1,7 +1,7 @@
1
1
  import { deepFreeze } from '@lwrjs/shared-utils';
2
2
  export function createProviderContext(serverContext) {
3
3
  // This is a subset of config to user-land code
4
- const { cacheDir, lwc: { modules = [] }, routes, errorRoutes, rootDir, contentDir, layoutsDir, locker, amdLoader, esmLoader, environment, basePath, bundleConfig, } = serverContext.appConfig;
4
+ const { assets, cacheDir, lwc: { modules = [] }, routes, errorRoutes, rootDir, contentDir, layoutsDir, locker, amdLoader, esmLoader, environment, basePath, bundleConfig, } = serverContext.appConfig;
5
5
  const { onModuleDefinitionChange, onModuleSourceChange } = serverContext.appObserver;
6
6
  const { notifyModuleDefinitionChanged, notifyModuleSourceChanged, notifyViewSourceChanged, notifyAssetSourceChanged, } = serverContext.appEmitter;
7
7
  return {
@@ -18,6 +18,7 @@ export function createProviderContext(serverContext) {
18
18
  viewRegistry: serverContext.viewRegistry.getPublicApi(),
19
19
  assetRegistry: serverContext.assetRegistry.getPublicApi(),
20
20
  config: deepFreeze({
21
+ assets,
21
22
  cacheDir,
22
23
  modules,
23
24
  routes,
@@ -5,10 +5,20 @@ function createAssetMiddleware(context) {
5
5
  const { assetRegistry, runtimeEnvironment: { basePath }, } = context;
6
6
  return async (req, res) => {
7
7
  const { runtimeEnvironment } = req.getRuntimeContext(context.runtimeEnvironment);
8
- const { assetId, signature } = getAssetIdentity(req);
8
+ const { assetId, immutable, signature } = getAssetIdentity(req);
9
9
  if (basePath && !assetId.specifier.startsWith(basePath)) {
10
10
  assetId.specifier = path.join(basePath, assetId.specifier);
11
11
  }
12
+ // Redirect if this is an external asset
13
+ const assetUri = await assetRegistry.resolveAssetUri(assetId, runtimeEnvironment);
14
+ if (assetUri.external) {
15
+ res.set({
16
+ Location: assetUri.uri,
17
+ 'cache-control': 'public, max-age=60',
18
+ });
19
+ res.sendStatus(302);
20
+ return;
21
+ }
12
22
  const asset = await assetRegistry.getAsset({ ...assetId, signature }, runtimeEnvironment, req.isSiteGeneration());
13
23
  if (req.isSiteGeneration()) {
14
24
  res.setSiteGenerationMetadata({ asset });
@@ -16,6 +26,12 @@ function createAssetMiddleware(context) {
16
26
  if (asset.mime) {
17
27
  res.type(asset.mime);
18
28
  }
29
+ if (runtimeEnvironment.immutableAssets && immutable) {
30
+ res.setHeader('Cache-control', 'public, max-age=12895706, immutable');
31
+ }
32
+ else if (runtimeEnvironment.immutableAssets) {
33
+ res.setHeader('Cache-control', 'public, max-age=60');
34
+ }
19
35
  res.status(200).stream(asset.stream());
20
36
  };
21
37
  }
@@ -45,15 +45,13 @@ export function getResourceIdentity(req) {
45
45
  export function getAssetIdentity(req) {
46
46
  const { signature, immutable, assetType: type } = req.params;
47
47
  const specifier = signature && type ? '/' + req.params[0] : req.originalUrl.split('?')[0];
48
- if (immutable) {
49
- // WIP: ?
50
- }
51
48
  if (validateSpecifier(specifier) === false) {
52
49
  throw createSingleDiagnosticError({
53
50
  description: descriptions.UNRESOLVABLE.INVALID_SPECIFIER(specifier),
54
51
  }, LwrUnresolvableError);
55
52
  }
56
53
  return {
54
+ immutable,
57
55
  assetId: {
58
56
  specifier,
59
57
  type,
@@ -90,6 +90,8 @@ export default class SiteGenerator {
90
90
  *
91
91
  */
92
92
  private copyAssets;
93
+ private addAssetsToMetadata;
94
+ private addAssetToMetadata;
93
95
  /**
94
96
  * Create a new site config for the current view
95
97
  */
@@ -100,7 +102,7 @@ export default class SiteGenerator {
100
102
  */
101
103
  private addAdditionalImportMetadataToViewConfig;
102
104
  /**
103
- * Capure additional metadata collected during the processing of a route or additional module
105
+ * Capture additional metadata collected during the processing of a route or additional module
104
106
  */
105
107
  private captureAdditionalRouteMetadata;
106
108
  }
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'perf_hooks';
2
- import { getSpecifier, getFeatureFlags, hashContent, isSelfUrl, getModuleUriPrefix, getMappingUriPrefix, logger, WARN, INFO, SiteMetadataImpl, isExternalUrl, } from '@lwrjs/shared-utils';
3
- import { join, dirname, extname } from 'path';
2
+ import { getSpecifier, getFeatureFlags, hashContent, isSelfUrl, getModuleUriPrefix, getMappingUriPrefix, logger, WARN, INFO, SiteMetadataImpl, isExternalUrl, mimeLookup, } from '@lwrjs/shared-utils';
3
+ import { join, dirname, extname, normalize } from 'path';
4
4
  import fs from 'fs-extra';
5
5
  import { writeResponse } from './utils/stream.js';
6
6
  import { createDir, createResourceDir } from './utils/dir.js';
@@ -41,7 +41,7 @@ export default class SiteGenerator {
41
41
  // Write redirect files
42
42
  this.writeNetlifyRedirectConfig(outputDir, urlRewriteMap);
43
43
  // Copy over assets
44
- this.copyAssets(assets, outputDir, basePath);
44
+ await this.copyAssets(assets, outputDir, config);
45
45
  const endTime = performance.now();
46
46
  const timeDiff = (endTime - startTime) / 1000;
47
47
  logger.info(`[SSG] Static Site Generation complete in ${Math.round(timeDiff)} seconds`);
@@ -184,11 +184,11 @@ export default class SiteGenerator {
184
184
  // Redirect encoded signed URIs to UNencoded signed URIs
185
185
  // e.g. /1/bundle/amd/l/en-US/bi/0/module/mi/c%2Fmodule%2Fv%2F0_1_6/s/{signature} -> /1/bundle/amd/l/en-US/bi/0/module/mi/c/module/v/0_1_6/s/{signature}
186
186
  siteConfig.urlRewriteMap.set(url.substring(0, url.indexOf('/s/')), normalizedUrl);
187
- // Redirect unversioned/unsigned URIs to signed URIs
187
+ // Redirect un-versioned/unsigned URIs to signed URIs
188
188
  // e.g. /1/bundle/amd/l/en-US/bi/0/module/mi/c/module -> /1/bundle/amd/l/en-US/bi/0/module/mi/c/module/v/0_1_6/s/{signature}
189
189
  // e.g. with importer /1/bundle/amd/l/en-US/bi/0/module/mi/c/module?importer=parent%2Fmodule%2Fv%2F2_1_0 -> /1/bundle/amd/l/en-US/bi/0/module/mi/c/module/v/0_1_6/s/{signature}
190
190
  siteConfig.urlRewriteMap.set(normalizedUrl.substring(0, normalizedUrl.indexOf('/v/')), normalizedUrl);
191
- // Redirect encoded unversioned/unsigned URIs to UNencoded signed URIs
191
+ // Redirect encoded un-versioned/unsigned URIs to UNencoded signed URIs
192
192
  // e.g. /1/bundle/amd/l/en-US/bi/0/module/mi/c%2Fmodule -> /1/bundle/amd/l/en-US/bi/0/module/mi/c/module/v/0_1_6/s/{signature}
193
193
  // e.g. with importer /1/bundle/amd/l/en-US/bi/0/module/mi/c%2Fmodule?importer=parent%2Fmodule%2Fv%2F2_1_0 -> /1/bundle/amd/l/en-US/bi/0/module/mi/c/module/v/0_1_6/s/{signature}
194
194
  siteConfig.urlRewriteMap.set(url.substring(0, url.indexOf('%2Fv%2F')), normalizedUrl);
@@ -270,7 +270,13 @@ export default class SiteGenerator {
270
270
  mimeType: String(assetDefinition.mime),
271
271
  };
272
272
  const siteAssets = siteConfig.siteMetadata.getSiteAssets();
273
- siteAssets.assets[specifier] = resourceMetadata;
273
+ // Do not overwrite
274
+ if (!siteAssets.assets[specifier]) {
275
+ siteAssets.assets[specifier] = resourceMetadata;
276
+ }
277
+ else {
278
+ logger.debug(`[SSG] Ignore asset redefinition ${specifier}`);
279
+ }
274
280
  }
275
281
  }
276
282
  }
@@ -282,22 +288,22 @@ export default class SiteGenerator {
282
288
  * @param dispatcher - Network dispatcher
283
289
  */
284
290
  async handleMappingResource(url, context, siteConfig, dispatcher) {
285
- const { importMetadata: importMetatdata } = siteConfig;
291
+ const { importMetadata: importMetadata } = siteConfig;
286
292
  const statusCode = context.response?.status;
287
293
  // Received a server error
288
294
  if (statusCode === 200) {
289
295
  // Read JSON
290
296
  const newImportMetadata = context.fs?.body;
291
297
  let filteredImportMetadata;
292
- if (!importMetatdata) {
298
+ if (!importMetadata) {
293
299
  filteredImportMetadata = newImportMetadata;
294
300
  }
295
301
  else {
296
302
  // need to handle importMetadata when generating from a view
297
- filteredImportMetadata = importMetatdata.addAdditionalMetadata(newImportMetadata);
303
+ filteredImportMetadata = importMetadata.addAdditionalMetadata(newImportMetadata);
298
304
  }
299
305
  // Filter out and import metadata already included with the view
300
- // const filteredImportMetadata = importMetatdata.addAdditionalMetadata(newImportMetadata);
306
+ // const filteredImportMetadata = importMetadata.addAdditionalMetadata(newImportMetadata);
301
307
  // Build up a list of dispatch requests to kick off in parallel
302
308
  const dispatchRequests = [];
303
309
  // Iterate through the import mappings and return request uris
@@ -533,22 +539,72 @@ export default class SiteGenerator {
533
539
  * @param assets AssetConfig
534
540
  *
535
541
  */
536
- copyAssets(assets, outputDir, basePath) {
542
+ async copyAssets(assets, outputDir, config) {
543
+ const { basePath } = config;
544
+ const runtimeEnvironment = getRuntimeEnvironment(config);
545
+ const siteConfig = this.createSiteConfig(outputDir, 'en-US', // Copy Assets should not use the locale
546
+ new Map(), true, runtimeEnvironment);
537
547
  for (const asset of assets) {
538
548
  try {
539
- const assetSrcDir = asset.dir || asset.file;
540
- const assetOutputDir = join(outputDir, basePath ? basePath + asset.urlPath : asset.urlPath);
549
+ const assetSrcFile = asset.file;
550
+ const assetSrcDir = asset.dir;
551
+ const assetsPath = join(outputDir, basePath ? basePath + asset.urlPath : asset.urlPath);
541
552
  if (assetSrcDir && fs.existsSync(assetSrcDir)) {
542
- fs.copySync(assetSrcDir, assetOutputDir);
553
+ fs.copySync(assetSrcDir, assetsPath);
554
+ this.addAssetsToMetadata(assetsPath, siteConfig);
555
+ }
556
+ else if (assetSrcFile && fs.existsSync(assetSrcFile)) {
557
+ fs.copySync(assetSrcFile, assetsPath);
558
+ this.addAssetToMetadata(assetsPath, siteConfig);
543
559
  }
544
560
  else {
545
- logger.warn('[SSG] Could not find assets to copy at path: ' + assetSrcDir);
561
+ logger.warn('[SSG] Could not find assets to copy at path: ' + assetsPath);
546
562
  }
547
563
  }
548
564
  catch (e) {
549
565
  logger.error('[SSG] Error occurred processing asset config: ' + JSON.stringify(asset), e);
550
566
  }
551
567
  }
568
+ await siteConfig.siteMetadata?.persistSiteMetadata();
569
+ }
570
+ addAssetsToMetadata(directoryPath, siteConfig) {
571
+ try {
572
+ const files = fs.readdirSync(directoryPath);
573
+ for (const file of files) {
574
+ const filePath = join(directoryPath, file);
575
+ if (fs.statSync(filePath).isDirectory()) {
576
+ this.addAssetsToMetadata(filePath, siteConfig);
577
+ }
578
+ else {
579
+ this.addAssetToMetadata(filePath, siteConfig);
580
+ }
581
+ }
582
+ }
583
+ catch (err) {
584
+ logger.warn(`[SSG] Unexpected error collecting asset directory metadata for ${directoryPath}`, err);
585
+ }
586
+ }
587
+ addAssetToMetadata(filePath, siteConfig) {
588
+ try {
589
+ const uri = encodeURI(normalize(filePath).replace(siteConfig.outputDir, ''));
590
+ this.addAssetToSiteMetadata({
591
+ uri,
592
+ type: 'asset',
593
+ stream: function (encoding) {
594
+ throw new Error('Function not implemented.');
595
+ },
596
+ entry: filePath,
597
+ ext: extname(filePath),
598
+ mime: mimeLookup(filePath),
599
+ ownHash: 'not-provided',
600
+ content: function (encoding) {
601
+ throw new Error('Function not implemented.');
602
+ },
603
+ }, uri, siteConfig);
604
+ }
605
+ catch (err) {
606
+ logger.warn(`[SSG] Unexpected error collecting asset metadata for ${filePath}`, err);
607
+ }
552
608
  }
553
609
  /**
554
610
  * Create a new site config for the current view
@@ -578,13 +634,13 @@ export default class SiteGenerator {
578
634
  filterFeatureFlags() {
579
635
  const ffs = getFeatureFlags();
580
636
  if (ffs && Object.keys(ffs).length) {
581
- const accumlator = {};
637
+ const accumulator = {};
582
638
  for (const [key, value] of Object.entries(ffs)) {
583
639
  if (value) {
584
- accumlator[key] = true;
640
+ accumulator[key] = true;
585
641
  }
586
642
  }
587
- return { featureFlags: accumlator };
643
+ return { featureFlags: accumulator };
588
644
  }
589
645
  else {
590
646
  return undefined;
@@ -631,7 +687,7 @@ export default class SiteGenerator {
631
687
  }
632
688
  }
633
689
  /**
634
- * Capure additional metadata collected during the processing of a route or additional module
690
+ * Capture additional metadata collected during the processing of a route or additional module
635
691
  */
636
692
  async captureAdditionalRouteMetadata(siteConfig) {
637
693
  // If there is a view config add any extra collected import metadata to the config
@@ -682,10 +738,10 @@ export class ViewImportMetadataImpl {
682
738
  /**
683
739
  * Merge new import metadata into target import metadata
684
740
  */
685
- mergeImportMetadata(targetImportMetdadata, newImportMetadata) {
686
- Object.assign(targetImportMetdadata.imports, newImportMetadata.imports);
687
- if (targetImportMetdadata.index) {
688
- Object.assign(targetImportMetdadata.index, newImportMetadata.index || {});
741
+ mergeImportMetadata(targetImportMetadata, newImportMetadata) {
742
+ Object.assign(targetImportMetadata.imports, newImportMetadata.imports);
743
+ if (targetImportMetadata.index) {
744
+ Object.assign(targetImportMetadata.index, newImportMetadata.index || {});
689
745
  }
690
746
  }
691
747
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.9.0-alpha.24",
7
+ "version": "0.9.0-alpha.27",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,29 +37,29 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@locker/compiler": "0.18.9",
40
- "@lwrjs/app-service": "0.9.0-alpha.24",
41
- "@lwrjs/asset-registry": "0.9.0-alpha.24",
42
- "@lwrjs/asset-transformer": "0.9.0-alpha.24",
43
- "@lwrjs/base-view-provider": "0.9.0-alpha.24",
44
- "@lwrjs/base-view-transformer": "0.9.0-alpha.24",
45
- "@lwrjs/client-modules": "0.9.0-alpha.24",
46
- "@lwrjs/config": "0.9.0-alpha.24",
47
- "@lwrjs/diagnostics": "0.9.0-alpha.24",
48
- "@lwrjs/fs-asset-provider": "0.9.0-alpha.24",
49
- "@lwrjs/html-view-provider": "0.9.0-alpha.24",
50
- "@lwrjs/loader": "0.9.0-alpha.24",
51
- "@lwrjs/lwc-module-provider": "0.9.0-alpha.24",
52
- "@lwrjs/markdown-view-provider": "0.9.0-alpha.24",
53
- "@lwrjs/module-bundler": "0.9.0-alpha.24",
54
- "@lwrjs/module-registry": "0.9.0-alpha.24",
55
- "@lwrjs/npm-module-provider": "0.9.0-alpha.24",
56
- "@lwrjs/nunjucks-view-provider": "0.9.0-alpha.24",
57
- "@lwrjs/o11y": "0.9.0-alpha.24",
58
- "@lwrjs/resource-registry": "0.9.0-alpha.24",
59
- "@lwrjs/router": "0.9.0-alpha.24",
60
- "@lwrjs/server": "0.9.0-alpha.24",
61
- "@lwrjs/shared-utils": "0.9.0-alpha.24",
62
- "@lwrjs/view-registry": "0.9.0-alpha.24",
40
+ "@lwrjs/app-service": "0.9.0-alpha.27",
41
+ "@lwrjs/asset-registry": "0.9.0-alpha.27",
42
+ "@lwrjs/asset-transformer": "0.9.0-alpha.27",
43
+ "@lwrjs/base-view-provider": "0.9.0-alpha.27",
44
+ "@lwrjs/base-view-transformer": "0.9.0-alpha.27",
45
+ "@lwrjs/client-modules": "0.9.0-alpha.27",
46
+ "@lwrjs/config": "0.9.0-alpha.27",
47
+ "@lwrjs/diagnostics": "0.9.0-alpha.27",
48
+ "@lwrjs/fs-asset-provider": "0.9.0-alpha.27",
49
+ "@lwrjs/html-view-provider": "0.9.0-alpha.27",
50
+ "@lwrjs/loader": "0.9.0-alpha.27",
51
+ "@lwrjs/lwc-module-provider": "0.9.0-alpha.27",
52
+ "@lwrjs/markdown-view-provider": "0.9.0-alpha.27",
53
+ "@lwrjs/module-bundler": "0.9.0-alpha.27",
54
+ "@lwrjs/module-registry": "0.9.0-alpha.27",
55
+ "@lwrjs/npm-module-provider": "0.9.0-alpha.27",
56
+ "@lwrjs/nunjucks-view-provider": "0.9.0-alpha.27",
57
+ "@lwrjs/o11y": "0.9.0-alpha.27",
58
+ "@lwrjs/resource-registry": "0.9.0-alpha.27",
59
+ "@lwrjs/router": "0.9.0-alpha.27",
60
+ "@lwrjs/server": "0.9.0-alpha.27",
61
+ "@lwrjs/shared-utils": "0.9.0-alpha.27",
62
+ "@lwrjs/view-registry": "0.9.0-alpha.27",
63
63
  "chokidar": "^3.5.3",
64
64
  "esbuild": "^0.9.7",
65
65
  "fs-extra": "^10.1.0",
@@ -69,7 +69,7 @@
69
69
  "ws": "^8.8.1"
70
70
  },
71
71
  "devDependencies": {
72
- "@lwrjs/types": "0.9.0-alpha.24",
72
+ "@lwrjs/types": "0.9.0-alpha.27",
73
73
  "@types/ws": "^8.5.3"
74
74
  },
75
75
  "peerDependencies": {
@@ -78,5 +78,5 @@
78
78
  "engines": {
79
79
  "node": ">=16.0.0 <20"
80
80
  },
81
- "gitHead": "94326d9e8c80254cfab9c17b2235b10fdee13b4d"
81
+ "gitHead": "a7fcd8493b8a3286197e829b28b54670e7d4e97c"
82
82
  }