@lwrjs/core 0.9.0-alpha.17 → 0.9.0-alpha.19

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.
@@ -70,7 +70,6 @@ function createServerContext(appConfig, runtimeEnvironment, globalData) {
70
70
  watcherFactory,
71
71
  appConfig,
72
72
  runtimeEnvironment,
73
- routes: [],
74
- errorRoutes: []
73
+ routeHandlers: {}
75
74
  };
76
75
  }
@@ -87,9 +87,8 @@ async function initContext(appConfig, runtimeEnvironment, globalData) {
87
87
  viewRegistry.addViewTransformers(viewTransformers);
88
88
  moduleBundler.addBundleProviders(bundleProviders);
89
89
  await serverContext.viewRegistry.initializeViewProviders();
90
- const {routes, errorRoutes} = await (0, import_modules.loadRoutes)(appConfig);
91
- serverContext.routes = routes;
92
- serverContext.errorRoutes = errorRoutes;
90
+ const routeHandlers = await (0, import_modules.loadRouteHandlers)(appConfig);
91
+ serverContext.routeHandlers = routeHandlers;
93
92
  return serverContext;
94
93
  }
95
94
  var LwrApp = class {
@@ -133,8 +133,9 @@ function createNotFoundMiddleware(errorRoutes, context, viewHandler) {
133
133
  };
134
134
  }
135
135
  function viewMiddleware(app, context) {
136
- const {appConfig, routes, errorRoutes, viewRegistry, moduleRegistry} = context;
137
- const viewHandler = new import_view_registry.LwrViewHandler({viewRegistry, moduleRegistry}, appConfig);
136
+ const {appConfig, viewRegistry, moduleRegistry, routeHandlers} = context;
137
+ const {routes, errorRoutes} = appConfig;
138
+ const viewHandler = new import_view_registry.LwrViewHandler({viewRegistry, moduleRegistry, routeHandlers}, appConfig);
138
139
  for (const route of routes) {
139
140
  const paths = [route.path];
140
141
  const subRoutes = route.subRoutes && (0, import_router.getClientRoutes)(route.subRoutes);
@@ -182,10 +182,8 @@ var SiteGenerator = class {
182
182
  const bundleMetadata = {
183
183
  version: bundleDefinition.version,
184
184
  path: decodeURIComponent(url),
185
- bundleRecord: {
186
- includedModules: bundleDefinition.bundleRecord.includedModules || [],
187
- imports
188
- }
185
+ includedModules: bundleDefinition.bundleRecord.includedModules || [],
186
+ imports
189
187
  };
190
188
  const siteBundles = siteConfig.siteMetadata.getSiteBundles().bundles;
191
189
  siteBundles[specifier] = bundleMetadata;
@@ -414,7 +412,7 @@ var SiteGenerator = class {
414
412
  endpoints,
415
413
  skipBaseDocumentGeneration,
416
414
  ...featureFlags,
417
- siteMetadata: new import_shared_utils.SiteMetadataImpl({rootDir: outputDir, runtimeEnvironment})
415
+ siteMetadata: new import_shared_utils.SiteMetadataImpl({rootDir: outputDir})
418
416
  };
419
417
  }
420
418
  filterFeatureFlags() {
@@ -1,3 +1,3 @@
1
- import { GlobalData, NormalizedLwrGlobalConfig, RuntimeEnvironment, ServerContext } from '@lwrjs/types';
1
+ import type { GlobalData, NormalizedLwrGlobalConfig, RuntimeEnvironment, ServerContext } from '@lwrjs/types';
2
2
  export declare function createServerContext(appConfig: NormalizedLwrGlobalConfig, runtimeEnvironment: RuntimeEnvironment, globalData: GlobalData): ServerContext;
3
3
  //# sourceMappingURL=server.d.ts.map
@@ -43,8 +43,7 @@ export function createServerContext(appConfig, runtimeEnvironment, globalData) {
43
43
  watcherFactory,
44
44
  appConfig,
45
45
  runtimeEnvironment,
46
- routes: [],
47
- errorRoutes: [],
46
+ routeHandlers: {},
48
47
  };
49
48
  }
50
49
  //# sourceMappingURL=server.js.map
package/build/es/index.js CHANGED
@@ -2,7 +2,7 @@ import { getFeatureFlags, DEFAULT_LWR_BOOTSTRAP_CONFIG, logger } from '@lwrjs/sh
2
2
  import { createInternalServer } from '@lwrjs/server';
3
3
  import { LwrServerError, createSingleDiagnosticError, descriptions } from '@lwrjs/diagnostics';
4
4
  import { loadConfig, executeConfigHooks, executeStartHooks } from '@lwrjs/config';
5
- import { loadHooks, loadServices, loadRoutes } from '@lwrjs/config/modules';
5
+ import { loadHooks, loadServices, loadRouteHandlers } from '@lwrjs/config/modules';
6
6
  import SiteGenerator from './tools/static-generation.js';
7
7
  import { warmupServer } from './tools/server-warmup.js';
8
8
  import { createServerContext } from './context/server.js';
@@ -71,9 +71,8 @@ async function initContext(appConfig, runtimeEnvironment, globalData) {
71
71
  // invoke async initialization
72
72
  await serverContext.viewRegistry.initializeViewProviders();
73
73
  // set routes on server context
74
- const { routes, errorRoutes } = await loadRoutes(appConfig);
75
- serverContext.routes = routes;
76
- serverContext.errorRoutes = errorRoutes;
74
+ const routeHandlers = await loadRouteHandlers(appConfig);
75
+ serverContext.routeHandlers = routeHandlers;
77
76
  return serverContext;
78
77
  }
79
78
  export class LwrApp {
@@ -113,8 +113,9 @@ function createNotFoundMiddleware(errorRoutes, context, viewHandler) {
113
113
  };
114
114
  }
115
115
  export function viewMiddleware(app, context) {
116
- const { appConfig, routes, errorRoutes, viewRegistry, moduleRegistry } = context;
117
- const viewHandler = new LwrViewHandler({ viewRegistry, moduleRegistry }, appConfig);
116
+ const { appConfig, viewRegistry, moduleRegistry, routeHandlers } = context;
117
+ const { routes, errorRoutes } = appConfig;
118
+ const viewHandler = new LwrViewHandler({ viewRegistry, moduleRegistry, routeHandlers }, appConfig);
118
119
  // create and attach middleware for each route
119
120
  for (const route of routes) {
120
121
  const paths = [route.path];
@@ -235,10 +235,8 @@ export default class SiteGenerator {
235
235
  const bundleMetadata = {
236
236
  version: bundleDefinition.version,
237
237
  path: decodeURIComponent(url),
238
- bundleRecord: {
239
- includedModules: bundleDefinition.bundleRecord.includedModules || [],
240
- imports,
241
- },
238
+ includedModules: bundleDefinition.bundleRecord.includedModules || [],
239
+ imports,
242
240
  };
243
241
  const siteBundles = siteConfig.siteMetadata.getSiteBundles().bundles;
244
242
  siteBundles[specifier] = bundleMetadata;
@@ -574,7 +572,7 @@ export default class SiteGenerator {
574
572
  skipBaseDocumentGeneration,
575
573
  // Only include LEGACY_LOADER if true
576
574
  ...featureFlags,
577
- siteMetadata: new SiteMetadataImpl({ rootDir: outputDir, runtimeEnvironment }),
575
+ siteMetadata: new SiteMetadataImpl({ rootDir: outputDir }),
578
576
  };
579
577
  }
580
578
  filterFeatureFlags() {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.9.0-alpha.17",
7
+ "version": "0.9.0-alpha.19",
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.2",
40
- "@lwrjs/app-service": "0.9.0-alpha.17",
41
- "@lwrjs/asset-registry": "0.9.0-alpha.17",
42
- "@lwrjs/asset-transformer": "0.9.0-alpha.17",
43
- "@lwrjs/base-view-provider": "0.9.0-alpha.17",
44
- "@lwrjs/base-view-transformer": "0.9.0-alpha.17",
45
- "@lwrjs/client-modules": "0.9.0-alpha.17",
46
- "@lwrjs/config": "0.9.0-alpha.17",
47
- "@lwrjs/diagnostics": "0.9.0-alpha.17",
48
- "@lwrjs/fs-asset-provider": "0.9.0-alpha.17",
49
- "@lwrjs/html-view-provider": "0.9.0-alpha.17",
50
- "@lwrjs/loader": "0.9.0-alpha.17",
51
- "@lwrjs/lwc-module-provider": "0.9.0-alpha.17",
52
- "@lwrjs/markdown-view-provider": "0.9.0-alpha.17",
53
- "@lwrjs/module-bundler": "0.9.0-alpha.17",
54
- "@lwrjs/module-registry": "0.9.0-alpha.17",
55
- "@lwrjs/npm-module-provider": "0.9.0-alpha.17",
56
- "@lwrjs/nunjucks-view-provider": "0.9.0-alpha.17",
57
- "@lwrjs/o11y": "0.9.0-alpha.17",
58
- "@lwrjs/resource-registry": "0.9.0-alpha.17",
59
- "@lwrjs/router": "0.9.0-alpha.17",
60
- "@lwrjs/server": "0.9.0-alpha.17",
61
- "@lwrjs/shared-utils": "0.9.0-alpha.17",
62
- "@lwrjs/view-registry": "0.9.0-alpha.17",
40
+ "@lwrjs/app-service": "0.9.0-alpha.19",
41
+ "@lwrjs/asset-registry": "0.9.0-alpha.19",
42
+ "@lwrjs/asset-transformer": "0.9.0-alpha.19",
43
+ "@lwrjs/base-view-provider": "0.9.0-alpha.19",
44
+ "@lwrjs/base-view-transformer": "0.9.0-alpha.19",
45
+ "@lwrjs/client-modules": "0.9.0-alpha.19",
46
+ "@lwrjs/config": "0.9.0-alpha.19",
47
+ "@lwrjs/diagnostics": "0.9.0-alpha.19",
48
+ "@lwrjs/fs-asset-provider": "0.9.0-alpha.19",
49
+ "@lwrjs/html-view-provider": "0.9.0-alpha.19",
50
+ "@lwrjs/loader": "0.9.0-alpha.19",
51
+ "@lwrjs/lwc-module-provider": "0.9.0-alpha.19",
52
+ "@lwrjs/markdown-view-provider": "0.9.0-alpha.19",
53
+ "@lwrjs/module-bundler": "0.9.0-alpha.19",
54
+ "@lwrjs/module-registry": "0.9.0-alpha.19",
55
+ "@lwrjs/npm-module-provider": "0.9.0-alpha.19",
56
+ "@lwrjs/nunjucks-view-provider": "0.9.0-alpha.19",
57
+ "@lwrjs/o11y": "0.9.0-alpha.19",
58
+ "@lwrjs/resource-registry": "0.9.0-alpha.19",
59
+ "@lwrjs/router": "0.9.0-alpha.19",
60
+ "@lwrjs/server": "0.9.0-alpha.19",
61
+ "@lwrjs/shared-utils": "0.9.0-alpha.19",
62
+ "@lwrjs/view-registry": "0.9.0-alpha.19",
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.17",
72
+ "@lwrjs/types": "0.9.0-alpha.19",
73
73
  "@types/ws": "^8.5.3"
74
74
  },
75
75
  "peerDependencies": {
@@ -78,5 +78,5 @@
78
78
  "engines": {
79
79
  "node": ">=14.15.4 <19"
80
80
  },
81
- "gitHead": "447417ff091802927b25cfc1bcb01da02264f41b"
81
+ "gitHead": "65623ff6f03a217321d7d342df391fb05c90eb19"
82
82
  }