@lwrjs/types 0.9.0-alpha.2 → 0.9.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 { CacheResponse, RenderOptions, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, Specifier, ViewParams, ViewRequest, ViewResponse } from './index';
1
+ import { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, ServiceCtor, Specifier, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
2
2
  export interface View {
3
3
  id: string;
4
4
  rootComponent?: string;
@@ -22,7 +22,7 @@ export interface NormalizedLwrRoute extends LwrRoute {
22
22
  export interface LwrErrorRoute extends LwrBaseRoute {
23
23
  status: 404 | 500;
24
24
  }
25
- export interface NormalizedLwrErrorRoute extends LwrBaseRoute {
25
+ export interface NormalizedLwrErrorRoute extends LwrErrorRoute {
26
26
  bootstrap: NormalizedLwrAppBootstrapConfig;
27
27
  }
28
28
  export interface LwrAppBootstrapConfig {
@@ -41,6 +41,9 @@ export interface LwrLockerConfig {
41
41
  trustedComponents?: string[];
42
42
  clientOnly?: boolean;
43
43
  }
44
+ export interface RouteHandlersConfig {
45
+ [id: string]: string;
46
+ }
44
47
  export interface LocalizedViewRequest extends ViewRequest {
45
48
  locale?: string;
46
49
  }
@@ -86,9 +89,9 @@ export interface LwrGlobalConfig {
86
89
  resourceProviders?: ServiceConfig[];
87
90
  viewProviders?: ServiceConfig[];
88
91
  viewTransformers?: ServiceConfig[];
89
- templateEngine?: string;
90
92
  routes?: LwrRoute[];
91
93
  errorRoutes?: LwrErrorRoute[];
94
+ routeHandlers?: RouteHandlersConfig;
92
95
  bundleConfig?: BundleConfig;
93
96
  serverType?: ServerTypes;
94
97
  staticSiteGenerator?: StaticSiteGenerator;
@@ -96,10 +99,12 @@ export interface LwrGlobalConfig {
96
99
  }
97
100
  export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig, 'lwc'>> {
98
101
  routes: NormalizedLwrRoute[];
102
+ errorRoutes: NormalizedLwrErrorRoute[];
99
103
  assets: AssetConfig[];
100
104
  lwrVersion: string;
101
105
  amdLoader: string;
102
106
  esmLoader: string;
107
+ hooks: ServiceEntry[];
103
108
  moduleProviders: ServiceEntry[];
104
109
  viewProviders: ServiceEntry[];
105
110
  viewTransformers: ServiceEntry[];
@@ -111,9 +116,31 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
111
116
  export interface StaticSiteGenerator {
112
117
  outputDir?: string;
113
118
  locales?: string[];
119
+ skipCleanOutputDir?: boolean;
120
+ skipBaseDocumentGeneration?: boolean;
114
121
  _additionalRoutePaths?: string[];
115
122
  _additionalModules?: string[];
116
123
  }
124
+ export interface ServerBuild {
125
+ appConfig: NormalizedLwrGlobalConfig;
126
+ runtimeEnvironment: RuntimeEnvironment;
127
+ globalData: GlobalData;
128
+ hooks: HooksPlugin[];
129
+ services: Services;
130
+ routeHandlers: RouteHandlers;
131
+ }
132
+ export interface Services {
133
+ moduleProviders: ResolvedServiceEntry<ModuleProvider>[];
134
+ bundleProviders: ResolvedServiceEntry<BundleProvider>[];
135
+ viewProviders: ResolvedServiceEntry<ViewProvider>[];
136
+ viewTransformers: ResolvedServiceEntry<ViewTransformPlugin>[];
137
+ resourceProviders: ResolvedServiceEntry<ResourceProvider>[];
138
+ assetProviders: ResolvedServiceEntry<AssetProvider>[];
139
+ assetTransformers: ResolvedServiceEntry<AssetTransformPlugin>[];
140
+ }
141
+ export interface RouteHandlers {
142
+ [id: string]: RouteHandlerFunction;
143
+ }
117
144
  interface AssetConfigCommon {
118
145
  urlPath: string;
119
146
  alias?: string;
@@ -136,12 +163,16 @@ export interface NormalizedLwcConfig extends Omit<LwcConfig, 'interchangeableMod
136
163
  }
137
164
  export declare type ServiceEntry = [string, any?];
138
165
  export declare type ServiceConfig = string | ServiceEntry;
166
+ export declare type ResolvedServiceEntry<T extends LwrService> = [ServiceCtor<T>, any?];
139
167
  export interface BundleConfig {
140
168
  exclude?: string[];
141
169
  UNSAFE_lwrDefaultExclude?: string[];
142
170
  external?: Record<string, string>;
143
171
  alias?: Record<string, string>;
144
172
  }
173
+ export interface BundleConfigOverrides extends BundleConfig {
174
+ appendExcludes?: boolean;
175
+ }
145
176
  export declare type Environment = string;
146
177
  export interface EnvironmentConfig {
147
178
  default?: Environment;
@@ -168,7 +199,35 @@ export interface InterchangeableModuleRecord {
168
199
  };
169
200
  }
170
201
  export interface HooksPlugin {
171
- initConfigs(lwrConfig: NormalizedLwrGlobalConfig, dataConfig: GlobalData, runtimeConfig: RuntimeEnvironment): Promise<void> | void;
202
+ /**
203
+ * Programmatically modify application and runtime configurations.
204
+ *
205
+ * @remarks
206
+ * These hooks are invoked both at build time and runtime for Express and Koa(not MRT).
207
+ *
208
+ * During server build, config hooks are invoked prior to static site generation
209
+ * and server bundling.
210
+ *
211
+ * For the `createServer`(ie. Express/Koa) runtime, these config hooks are invoked before all other hooks
212
+ * during server context initialization
213
+ *
214
+ * For the `createHandler`(ie. MRT Serverless Express) runtime, these config hooks are NOT invoked. This runtime does
215
+ * not support asynchronous execution during initialization. These hooks MUST be ran during
216
+ * the server build.
217
+ *
218
+ */
219
+ initConfigs?: (lwrConfig: NormalizedLwrGlobalConfig, dataConfig: GlobalData, runtimeConfig: RuntimeEnvironment) => Promise<void> | void;
220
+ /**
221
+ * Load routes on application start up.
222
+ *
223
+ * @remarks
224
+ * These hooks are invoked ONLY at runtime.
225
+ *
226
+ * For the `createServer` runtime, these hooks are invoked AFTER config hooks.
227
+ *
228
+ * For the `createHandler` runtime, these hooks are invoked during server context initialization.
229
+ */
230
+ onStart?: (routes: LwrRoute[]) => void;
172
231
  }
173
232
  export {};
174
233
  //# sourceMappingURL=config.d.ts.map
package/build/index.d.ts CHANGED
@@ -2,12 +2,11 @@
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node" />
5
- /// <reference types="node" />
5
+ import type { WatchOptions } from 'chokidar';
6
6
  import { EventEmitter } from 'events';
7
7
  import fs from 'fs';
8
- import { Server } from 'http';
9
8
  import { Readable } from 'stream';
10
- import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord } from './config.js';
9
+ import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers } from './config.js';
11
10
  import { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
12
11
  export * from './lwr-shim.js';
13
12
  export * from './config.js';
@@ -164,8 +163,10 @@ export interface ServerModeConfig {
164
163
  };
165
164
  featureFlags: FeatureFlags;
166
165
  }
167
- export interface FeatureFlags {
168
- LEGACY_LOADER: boolean;
166
+ export interface FeatureFlags extends Record<string, boolean | undefined> {
167
+ LEGACY_LOADER?: boolean;
168
+ SSR_STATIC_BUNDLES?: boolean;
169
+ SSR_SANDBOX_WORKER?: boolean;
169
170
  }
170
171
  export interface RuntimeEnvironment extends ServerModeConfig {
171
172
  apiVersion: string;
@@ -201,6 +202,11 @@ export interface BootstrapRuntimeEnvironment extends RuntimeEnvironment {
201
202
  bootstrapImports?: string[];
202
203
  bootstrapDynamicImports?: string[];
203
204
  }
205
+ export type { WatchOptions } from 'chokidar';
206
+ export interface WatcherFactory {
207
+ createFileWatcher(options?: WatchOptions): Watcher;
208
+ setupWatcher(onModuleChange: Function): Watcher;
209
+ }
204
210
  export interface Watcher extends EventEmitter {
205
211
  add(paths: string | ReadonlyArray<string>): void;
206
212
  unwatch(paths: string | ReadonlyArray<string>): void;
@@ -254,7 +260,7 @@ export interface ModuleProvider {
254
260
  }
255
261
  export declare type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
256
262
  export interface ServiceCtor<T extends LwrService, R extends Record<string, Json> = {}> {
257
- new (moduleProviderConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
263
+ new (providerConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
258
264
  }
259
265
  export interface ModuleRegistry {
260
266
  name: string;
@@ -265,11 +271,18 @@ export interface ModuleRegistry {
265
271
  resolveModuleUri<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: R, runtimeParams?: RuntimeParams, signature?: S): S extends string ? string : Promise<string>;
266
272
  getPublicApi(): PublicModuleRegistry;
267
273
  }
268
- export declare type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'resolveModuleUri'>;
274
+ export declare type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
275
+ export interface BundleProvider {
276
+ name: string;
277
+ bundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams: RuntimeParams, configOverrides?: BundleConfig): Promise<BundleDefinition | undefined>;
278
+ }
269
279
  export interface ModuleBundler {
270
- getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfig): Promise<BundleDefinition>;
280
+ addBundleProviders(providers: BundleProvider[]): void;
281
+ getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfigOverrides): Promise<BundleDefinition>;
282
+ resolveModuleUri(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): Promise<string>;
283
+ getPublicApi(): PublicModuleBundler;
271
284
  }
272
- export declare type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle'>;
285
+ export declare type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
273
286
  export interface BundleRecord {
274
287
  imports?: BaseModuleReference[];
275
288
  dynamicImports?: BaseDynamicModuleReference[];
@@ -280,6 +293,7 @@ export interface BundleDefinition extends ModuleId {
280
293
  config: BundleConfig;
281
294
  map?: any;
282
295
  bundleRecord: BundleRecord;
296
+ src?: string;
283
297
  }
284
298
  export interface ProviderAppConfig {
285
299
  modules: ResolverModuleRecord[];
@@ -294,9 +308,9 @@ export interface ProviderAppConfig {
294
308
  amdLoader: string;
295
309
  esmLoader: string;
296
310
  environment?: EnvironmentConfig;
311
+ bundleConfig: BundleConfig;
297
312
  }
298
313
  export interface ProviderContext {
299
- compiler: Compiler;
300
314
  appObserver: Pick<LwrAppObserver, 'onModuleDefinitionChange' | 'onModuleSourceChange' | 'onAssetSourceChange' | 'onViewSourceChange'>;
301
315
  appEmitter: Pick<LwrAppEmitter, 'notifyModuleDefinitionChanged' | 'notifyAssetSourceChanged' | 'notifyModuleSourceChanged' | 'notifyViewSourceChanged'>;
302
316
  moduleRegistry: PublicModuleRegistry;
@@ -306,6 +320,8 @@ export interface ProviderContext {
306
320
  assetRegistry: PublicAssetRegistry;
307
321
  config: ProviderAppConfig;
308
322
  runtimeEnvironment: RuntimeEnvironment;
323
+ watcherFactory?: WatcherFactory;
324
+ siteMetadata?: SiteMetadata;
309
325
  }
310
326
  export interface ResourceIdentifier {
311
327
  specifier: string;
@@ -321,7 +337,7 @@ export interface AssetUri {
321
337
  immutable: boolean;
322
338
  entry: string;
323
339
  }
324
- export declare type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module';
340
+ export declare type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module' | string;
325
341
  export interface ResourceDefinition {
326
342
  specifier?: string;
327
343
  type: ResourceType;
@@ -331,7 +347,7 @@ export interface ResourceDefinition {
331
347
  defer?: boolean;
332
348
  nonce?: string;
333
349
  content?: string;
334
- stream?: Readable;
350
+ stream?: () => Readable;
335
351
  isPreload?: boolean;
336
352
  }
337
353
  export interface AssetMetadata {
@@ -397,12 +413,13 @@ export declare type PublicResourceRegistry = Pick<ResourceRegistry, 'getResource
397
413
  export interface AssetRegistry {
398
414
  name: string;
399
415
  addAssetProviders(provider: AssetProvider[]): void;
416
+ addAssetTransformers(transformers: AssetTransformPlugin[]): void;
400
417
  getAsset<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T, includeMetadata?: boolean): Promise<AssetDefinition>;
401
418
  resolveAssetUri<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<AssetUri>;
402
419
  getPublicApi(): PublicAssetRegistry;
403
420
  }
404
421
  export declare type PublicAssetRegistry = Pick<AssetRegistry, 'getAsset' | 'resolveAssetUri'>;
405
- export interface CompilerConfig {
422
+ export interface LwcCompilerConfig {
406
423
  name: string;
407
424
  namespace?: string;
408
425
  filename: string;
@@ -436,22 +453,6 @@ export interface CompilerResult {
436
453
  export interface BundleFiles {
437
454
  [filename: string]: string;
438
455
  }
439
- export interface Compiler {
440
- convertToAmd(source: string, { id }: {
441
- id: string;
442
- }): Promise<CompilerResult>;
443
- getModuleMetadata(compiledSource: string): Promise<Partial<CompiledMetadata>>;
444
- lockerize(compiledModule: ModuleCompiled, lockerConfig: LwrLockerConfig, sourcemap: boolean): CompilerResult;
445
- minifyJavascript(source: string): Promise<CompilerResult>;
446
- parseJavascript(source: string, options: ParseOptions): Promise<CompilerResult>;
447
- minifyCSS(source: string): Promise<CompilerResult>;
448
- }
449
- export interface ParseOptions {
450
- envMode: string;
451
- }
452
- export interface CompilerContext {
453
- runtimeEnvironment: RuntimeEnvironment;
454
- }
455
456
  export interface ClientBootstrapConfig {
456
457
  appId?: string;
457
458
  bootstrapModule: string;
@@ -494,15 +495,16 @@ export interface MetricsConfig {
494
495
  export interface ServerContext {
495
496
  appObserver: LwrAppObserver;
496
497
  appEmitter: LwrAppEmitter;
497
- server: Server;
498
- compiler: Compiler;
499
498
  moduleRegistry: ModuleRegistry;
500
499
  moduleBundler: ModuleBundler;
501
500
  viewRegistry: ViewRegistry;
502
501
  resourceRegistry: ResourceRegistry;
503
502
  assetRegistry: AssetRegistry;
503
+ watcherFactory?: WatcherFactory;
504
+ siteMetadata?: SiteMetadata;
504
505
  appConfig: NormalizedLwrGlobalConfig;
505
506
  runtimeEnvironment: RuntimeEnvironment;
507
+ routeHandlers: RouteHandlers;
506
508
  }
507
509
  export interface Observer<V> {
508
510
  next: (value: V) => void;
@@ -579,4 +581,46 @@ export interface LwrStringBuilder {
579
581
  toString(): string;
580
582
  original: string;
581
583
  }
584
+ export interface SiteMetadata {
585
+ /**
586
+ * Get the path that all site metadata is relative to
587
+ */
588
+ getSiteRootDir(): string;
589
+ /**
590
+ * Get the current metadata about the pre-built module bundles for the site.
591
+ */
592
+ getSiteBundles(): SiteBundles;
593
+ /**
594
+ * Get the current metadata about the pre-built resources for the site.
595
+ */
596
+ getSiteResources(): SiteResources;
597
+ /**
598
+ * Get the current metadata about the pre-built assets for the site.
599
+ */
600
+ getSiteAssets(): SiteAssets;
601
+ /**
602
+ * To save out metadata for the current site
603
+ * @param staticRoot
604
+ * @returns
605
+ */
606
+ persistSiteMetadata(): Promise<void>;
607
+ }
608
+ export interface SiteBundles {
609
+ bundles: Record<string, SiteBundle>;
610
+ }
611
+ export interface SiteResources {
612
+ resources: Record<string, SiteArtifact>;
613
+ }
614
+ export interface SiteAssets {
615
+ assets: Record<string, SiteArtifact>;
616
+ }
617
+ export interface SiteArtifact {
618
+ path: string;
619
+ mimeType?: string;
620
+ }
621
+ export interface SiteBundle extends SiteArtifact {
622
+ version?: Version;
623
+ imports: string[];
624
+ includedModules?: string[];
625
+ }
582
626
  //# sourceMappingURL=index.d.ts.map
package/build/server.d.ts CHANGED
@@ -4,7 +4,7 @@ import { Application as ExpressApp } from 'express';
4
4
  import Koa, { Context } from 'koa';
5
5
  import http from 'http';
6
6
  import { Readable } from 'stream';
7
- import { RuntimeContext, RuntimeEnvironment } from './index';
7
+ import type { NormalizedLwrGlobalConfig, RuntimeContext, RuntimeEnvironment } from './index.js';
8
8
  export declare type ServerTypes = 'koa' | 'express' | 'fs';
9
9
  export declare type ServerTypeImpl<T extends ServerTypes> = T extends 'koa' ? Koa : T extends 'express' ? ExpressApp : T extends 'fs' ? LwrDispatcher : never;
10
10
  export interface FsContext extends Context {
@@ -37,6 +37,7 @@ export interface InternalAppServer<T extends ServerTypes> {
37
37
  }
38
38
  export declare type PublicAppServer<T extends ServerTypes> = Pick<InternalAppServer<T>, 'use' | 'all' | 'get' | 'post' | 'getRegexWildcard'>;
39
39
  export declare type InternalAppServerOptions = {
40
+ app?: ServerTypeImpl<ServerTypes>;
40
41
  basePath?: string;
41
42
  };
42
43
  export interface InternalAppServerConstructable {
@@ -59,6 +60,9 @@ export interface MiddlewareRequest {
59
60
  acceptsLanguages(): string[];
60
61
  get(field: string): string | undefined;
61
62
  cookie(name: string): string | undefined;
63
+ /**
64
+ * Return true if the request has a `json` query parameter
65
+ */
62
66
  hasJsonParam(): boolean;
63
67
  /**
64
68
  * Return JSON if:
@@ -66,20 +70,27 @@ export interface MiddlewareRequest {
66
70
  * - the Accept header explicitly requests "application/json"
67
71
  */
68
72
  isJsonRequest(): boolean;
73
+ /**
74
+ * Return true if the request was initiated by static generation
75
+ */
76
+ isSiteGeneration(): boolean;
69
77
  /**
70
78
  * Return false when both Accept and JSON query param are applied, but do not semantically match
71
79
  */
72
80
  validateJsonRequest(): boolean;
73
81
  /**
74
- * Use the Express Request parameters to create a Module/Resource Identifier and RuntimeEnvironment
82
+ * Return true when the environment path parameter exists and is supported
83
+ */
84
+ validateEnvironmentRequest(config: NormalizedLwrGlobalConfig): boolean;
85
+ /**
86
+ * Use the request parameters to resolve the runtime context(ie. environment and parameters)
75
87
  */
76
88
  getRuntimeContext(defaultRuntimeEnvironment: RuntimeEnvironment): RuntimeContext;
77
- isSiteGeneration(): boolean;
78
89
  }
79
90
  export interface MiddlewareResponse {
80
91
  set(header: any): void;
81
92
  setHeader(name: string, value: string | string[]): void;
82
- setMetadata(metadata: any): void;
93
+ setSiteGenerationMetadata(metadata: any): void;
83
94
  status(status: number): MiddlewareResponse;
84
95
  send(object: any): void;
85
96
  sendStatus(httpCode: number): void;
package/build/views.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { RouteHandlerFunction, RouteHandlerView, View } from './config.js';
2
+ import { LwrErrorRoute, LwrRoute, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
3
3
  import { AssetSource, AssetUri, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier, TransformPluginContext } from './index.js';
4
4
  export declare type ViewIdentity = Pick<View, 'rootComponent' | 'contentTemplate'>;
5
5
  export interface ViewSource {
@@ -82,6 +82,7 @@ export interface LinkedViewDefinition {
82
82
  renderedView: string;
83
83
  viewRecord: RenderedViewRecord;
84
84
  immutable: boolean;
85
+ cache?: CacheResponse;
85
86
  }
86
87
  interface ViewRequestQs {
87
88
  [key: string]: undefined | string | string[];
@@ -136,6 +137,7 @@ declare type ViewPluginLinkHook = (builder: LwrStringBuilder, viewContext: ViewT
136
137
  declare type ViewPluginLinkHookReturn = void | null | undefined | false | LwrStringBuilder | {
137
138
  builder?: LwrStringBuilder;
138
139
  context?: TransformPluginContext;
140
+ cache?: CacheResponse;
139
141
  };
140
142
  declare type ViewPluginOptimizeHook = (code: string, assetSource: AssetSource, context?: TransformPluginContext) => Promise<ViewPluginOptimizeHookReturn>;
141
143
  declare type ViewPluginOptimizeHookReturn = null | undefined | false | string | {
@@ -174,6 +176,7 @@ export declare type ViewModuleResourceContext = {
174
176
  };
175
177
  export interface ViewRegistry {
176
178
  addViewProviders(providers: ViewProvider[]): void;
179
+ addViewTransformers(transformers: ViewTransformPlugin[]): void;
177
180
  initializeViewProviders(): Promise<void[]>;
178
181
  getView(viewId: ViewIdentity, skipCaching?: boolean): Promise<CompiledView>;
179
182
  getViewDefinition<R extends RuntimeEnvironment>(view: View, viewParams: ViewParams, runtimeEnvironment: R, runtimeParams?: RuntimeParams, renderOptions?: RenderOptions): Promise<LinkedViewDefinition>;
@@ -181,6 +184,11 @@ export interface ViewRegistry {
181
184
  getPublicApi(): PublicViewRegistry;
182
185
  }
183
186
  export declare type PublicViewRegistry = Pick<ViewRegistry, 'getView' | 'getViewDefinition'>;
187
+ export interface ViewHandler {
188
+ getViewContent(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
189
+ getViewJson(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
190
+ getViewConfiguration(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse | undefined>;
191
+ }
184
192
  export interface SsrRequestContext {
185
193
  props: Json;
186
194
  params: {
@@ -201,6 +209,7 @@ export interface PageDataResponse {
201
209
  fetchpriority?: 'high' | 'low' | 'auto';
202
210
  }[];
203
211
  };
212
+ cache?: CacheResponse;
204
213
  }
205
214
  export {};
206
215
  //# sourceMappingURL=views.d.ts.map
package/package.json CHANGED
@@ -8,15 +8,15 @@
8
8
  "build": "tsc -b"
9
9
  },
10
10
  "type": "module",
11
- "version": "0.9.0-alpha.2",
11
+ "version": "0.9.0-alpha.21",
12
12
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/salesforce/lwr.git",
15
+ "url": "https://github.com/salesforce-experience-platform-emu/lwr.git",
16
16
  "directory": "packages/@lwrjs/types"
17
17
  },
18
18
  "bugs": {
19
- "url": "https://github.com/salesforce/lwr/issues"
19
+ "url": "https://github.com/salesforce-experience-platform-emu/lwr/issues"
20
20
  },
21
21
  "main": "build/index.js",
22
22
  "files": [
@@ -26,5 +26,12 @@
26
26
  "engines": {
27
27
  "node": ">=14.15.4 <19"
28
28
  },
29
- "gitHead": "bcf63de23d1a2a53fb0e961dba4396e8753710dd"
29
+ "devDependencies": {
30
+ "chokidar": "^3.5.3"
31
+ },
32
+ "volta": {
33
+ "node": "14.19.1",
34
+ "yarn": "1.22.19"
35
+ },
36
+ "gitHead": "a89adcac80601f657becd6fd734c765e6b2a2745"
30
37
  }