@lwrjs/types 0.12.0-alpha.2 → 0.12.0-alpha.21

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.
package/build/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, ServiceCtor, Specifier, UriTransformPlugin, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
1
+ import type { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerContext, ServerTypes, ServiceCtor, Specifier, UriTransformPlugin, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
2
2
  export interface View {
3
3
  id: string;
4
4
  rootComponent?: string;
@@ -40,6 +40,7 @@ export interface LwrAppBootstrapConfig {
40
40
  services?: (string | BootstrapService)[];
41
41
  configAsSrc?: boolean;
42
42
  ssr?: boolean;
43
+ preloadData?: boolean;
43
44
  mixedMode?: boolean;
44
45
  module?: string | undefined;
45
46
  preloadModules?: string[];
@@ -60,6 +61,7 @@ export interface NormalizedRouteHandlersConfig {
60
61
  }
61
62
  export interface LocalizedViewRequest extends ViewRequest {
62
63
  locale?: string;
64
+ basePath?: string;
63
65
  }
64
66
  export type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext, routeHandlerOptions?: any) => Promise<RouteHandlerViewResponse> | RouteHandlerViewResponse;
65
67
  export interface ResourcePaths {
@@ -213,6 +215,9 @@ export interface BundleConfig {
213
215
  alias?: Record<string, string>;
214
216
  groups?: BundleGroups;
215
217
  }
218
+ export interface ModuleRegistryConfig {
219
+ bundleConfig: BundleConfig;
220
+ }
216
221
  export interface BundleConfigOverrides extends BundleConfig {
217
222
  appendExcludes?: boolean;
218
223
  }
@@ -242,6 +247,9 @@ export interface InterchangeableModuleRecord {
242
247
  [target: string]: string;
243
248
  };
244
249
  }
250
+ export interface Instrumentation {
251
+ flush(): void;
252
+ }
245
253
  export interface HooksPlugin {
246
254
  /**
247
255
  * Programmatically modify application and runtime configurations.
@@ -268,7 +276,7 @@ export interface HooksPlugin {
268
276
  * - When running LWR server, these hooks are invoked after `initConfigs` hooks and before `onStart` hooks
269
277
  * - When running LWR handler, these hooks are invoked before config normalization and `onStart` hooks
270
278
  */
271
- initInstrumentation?: () => void;
279
+ initInstrumentation?: () => Instrumentation;
272
280
  /**
273
281
  * Set a subset of LWR Configuration at runtime. Works in mrt
274
282
  *
@@ -280,6 +288,15 @@ export interface HooksPlugin {
280
288
  * For the `createHandler` runtime, these hooks are invoked during server context initialization.
281
289
  */
282
290
  onStart?: (config: OnStartConfig) => void;
291
+ /**
292
+ *
293
+ * Attach instantiated route handlers, providers, and transformers directly to the server context.
294
+ *
295
+ * @remarks
296
+ * This is a temporary hook to enable a tactical solution for LWR@MRT local development
297
+ *
298
+ */
299
+ setupServerContext?: (context: ServerContext, startHooks: HooksPlugin[]) => Promise<void> | void;
283
300
  }
284
301
  export interface Locale {
285
302
  id: string;
@@ -290,6 +307,6 @@ export interface I18NConfig {
290
307
  locales: Locale[];
291
308
  uriPattern?: UriPattern;
292
309
  }
293
- export type UriPattern = undefined | 'path-prefix' | 'query-param';
310
+ export type UriPattern = undefined | 'path-prefix';
294
311
  export {};
295
312
  //# sourceMappingURL=config.d.ts.map
package/build/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { WatchOptions } from 'chokidar';
6
6
  import type { EventEmitter } from 'events';
7
7
  import type fs from 'fs';
8
8
  import type { Readable } from 'stream';
9
- import type { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers, AssetConfig, I18NConfig } from './config.js';
9
+ import type { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers, AssetConfig, I18NConfig, ModuleRegistryConfig } from './config.js';
10
10
  import type { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
11
11
  export * from './lwr-shim.js';
12
12
  export * from './config.js';
@@ -73,6 +73,7 @@ interface BaseModuleEntry {
73
73
  id: string;
74
74
  entry: string;
75
75
  virtual?: boolean;
76
+ external?: boolean;
76
77
  scope?: string;
77
78
  specifier: Specifier;
78
79
  version: Version;
@@ -92,6 +93,7 @@ export interface BaseModuleReference {
92
93
  specifier: string;
93
94
  version: Version;
94
95
  interchangeable?: boolean;
96
+ externalSrc?: string;
95
97
  }
96
98
  export interface ImportModuleReference extends BaseModuleReference {
97
99
  sourceSpecifier: Specifier;
@@ -283,9 +285,10 @@ export interface ModuleRegistry {
283
285
  getModuleEntry(moduleId: AbstractModuleId, runtimeParams?: RuntimeParams): Promise<ModuleEntry>;
284
286
  resolveModuleUri<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: R, runtimeParams?: RuntimeParams, signature?: S): Promise<string>;
285
287
  resolveModuleUriSync<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, signature: S, runtimeEnvironment: R, runtimeParams?: RuntimeParams): string;
288
+ getConfig(): ModuleRegistryConfig;
286
289
  getPublicApi(): PublicModuleRegistry;
287
290
  }
288
- export type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
291
+ export type PublicModuleRegistry = Pick<ModuleRegistry, 'getConfig' | 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
289
292
  export interface BundleProvider {
290
293
  name: string;
291
294
  bundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams: RuntimeParams, configOverrides?: BundleConfig): Promise<BundleDefinition | undefined>;
@@ -295,9 +298,10 @@ export interface ModuleBundler {
295
298
  addBundleTransformers(transformers: UriTransformPlugin[]): void;
296
299
  getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfigOverrides): Promise<BundleDefinition>;
297
300
  resolveModuleUri(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): Promise<string>;
301
+ getConfig(): BundleConfig;
298
302
  getPublicApi(): PublicModuleBundler;
299
303
  }
300
- export type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
304
+ export type PublicModuleBundler = Pick<ModuleBundler, 'getConfig' | 'getModuleBundle' | 'resolveModuleUri'>;
301
305
  export interface BundleRecord {
302
306
  imports?: BaseModuleReference[];
303
307
  dynamicImports?: BaseDynamicModuleReference[];
@@ -8,6 +8,14 @@ interface LwrShim {
8
8
  getResourceProviders(context: Partial<ProviderContext>): ResourceProvider[];
9
9
  getViewProviders(context: Partial<ProviderContext>): ViewProvider[];
10
10
  getViewTransformers(context: Partial<ProviderContext>): ViewTransformPlugin[];
11
+ env: GlobalThisEnvironment;
12
+ }
13
+ export interface GlobalThisEnvironment {
14
+ SSR: string | undefined;
15
+ basePath: string | undefined;
16
+ locale: string | undefined;
17
+ assetBasePath: string | undefined;
18
+ uiBasePath: string | undefined;
11
19
  }
12
20
  declare global {
13
21
  const LWR: LwrShim | undefined;
package/build/server.d.ts CHANGED
@@ -34,7 +34,6 @@ export interface InternalAppServer<T extends ServerTypes> {
34
34
  initRoutes(): void;
35
35
  getRegexWildcard(): string;
36
36
  }
37
- export type PublicAppServer<T extends ServerTypes> = Pick<InternalAppServer<T>, 'use' | 'all' | 'get' | 'post' | 'getRegexWildcard'>;
38
37
  export type InternalAppServerOptions = {
39
38
  app?: ServerTypeImpl<ServerTypes>;
40
39
  basePath?: string;
@@ -82,6 +81,10 @@ export interface MiddlewareRequest {
82
81
  * Return true when the environment path parameter exists and is supported
83
82
  */
84
83
  validateEnvironmentRequest(config: NormalizedLwrGlobalConfig): boolean;
84
+ /**
85
+ * Return true when the api version path parameter exists and is supported
86
+ */
87
+ validateApiVersion(config: NormalizedLwrGlobalConfig): boolean;
85
88
  /**
86
89
  * Use the request parameters to resolve the runtime context(ie. environment and parameters)
87
90
  */
package/build/views.d.ts CHANGED
@@ -23,12 +23,10 @@ export interface RenderingResult {
23
23
  renderedView: string;
24
24
  metadata?: RenderedViewMetadata;
25
25
  options?: RenderOptions;
26
+ cache?: CacheResponse;
26
27
  }
27
- export interface RenderedView {
28
+ export interface RenderedView extends NormalizedRenderingResult {
28
29
  compiledView: CompiledView;
29
- renderedView: string;
30
- metadata: RenderedViewMetadata;
31
- options: RenderOptions;
32
30
  }
33
31
  export interface CustomElementReference {
34
32
  tagName: string;
@@ -128,6 +126,9 @@ export interface ViewProvider {
128
126
  getView(viewId: ViewIdentity): Promise<CompiledView | undefined>;
129
127
  }
130
128
  export interface ViewTransformPluginContext {
129
+ config: {
130
+ cacheDir: string;
131
+ };
131
132
  view: View;
132
133
  viewParams: ViewParams;
133
134
  runtimeEnvironment: RuntimeEnvironment;
@@ -205,6 +206,12 @@ export interface SsrRequestContext {
205
206
  locale: string;
206
207
  basePath: string;
207
208
  }
209
+ export interface SsrRequestOptions {
210
+ bundleSpecifier: string;
211
+ cacheDir: string;
212
+ host?: string;
213
+ requestDepth?: number;
214
+ }
208
215
  export interface SsrDataResponse {
209
216
  props?: {
210
217
  [prop: string]: Json;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "build": "tsc -b"
9
9
  },
10
10
  "type": "module",
11
- "version": "0.12.0-alpha.2",
11
+ "version": "0.12.0-alpha.21",
12
12
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
13
13
  "repository": {
14
14
  "type": "git",
@@ -24,10 +24,10 @@
24
24
  "build/**/*.d.ts"
25
25
  ],
26
26
  "devDependencies": {
27
- "chokidar": "^3.5.3"
27
+ "chokidar": "^3.6.0"
28
28
  },
29
29
  "engines": {
30
30
  "node": ">=18.0.0"
31
31
  },
32
- "gitHead": "586a2aa659882483af9249dc3db7fe07bc842a25"
32
+ "gitHead": "3d77678ca2f568fcbe29efa2bf7e6f75778be50c"
33
33
  }