@lwrjs/types 0.9.0-alpha.11 → 0.9.0-alpha.13

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, 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;
@@ -100,6 +100,7 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
100
100
  lwrVersion: string;
101
101
  amdLoader: string;
102
102
  esmLoader: string;
103
+ hooks: ServiceEntry[];
103
104
  moduleProviders: ServiceEntry[];
104
105
  viewProviders: ServiceEntry[];
105
106
  viewTransformers: ServiceEntry[];
@@ -111,10 +112,30 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
111
112
  export interface StaticSiteGenerator {
112
113
  outputDir?: string;
113
114
  locales?: string[];
115
+ skipCleanOutputDir?: boolean;
114
116
  skipBaseDocumentGeneration?: boolean;
115
117
  _additionalRoutePaths?: string[];
116
118
  _additionalModules?: string[];
117
119
  }
120
+ export interface ServerBuild {
121
+ appConfig: NormalizedLwrGlobalConfig;
122
+ runtimeEnvironment: RuntimeEnvironment;
123
+ globalData: GlobalData;
124
+ services: Services;
125
+ routes: Route<NormalizedLwrRoute>[];
126
+ errorRoutes: Route<NormalizedLwrErrorRoute>[];
127
+ }
128
+ export interface Services {
129
+ moduleProviders: ResolvedServiceEntry<ModuleProvider>[];
130
+ viewProviders: ResolvedServiceEntry<ViewProvider>[];
131
+ viewTransformers: ResolvedServiceEntry<ViewTransformPlugin>[];
132
+ resourceProviders: ResolvedServiceEntry<ResourceProvider>[];
133
+ assetProviders: ResolvedServiceEntry<AssetProvider>[];
134
+ assetTransformers: ResolvedServiceEntry<AssetTransformPlugin>[];
135
+ }
136
+ export declare type Route<T extends LwrBaseRoute> = (T extends LwrRoute ? Omit<NormalizedLwrRoute, 'routeHandler'> : Omit<NormalizedLwrErrorRoute, 'routeHandler'>) & {
137
+ routeHandler?: RouteHandlerFunction;
138
+ };
118
139
  interface AssetConfigCommon {
119
140
  urlPath: string;
120
141
  alias?: string;
@@ -137,6 +158,7 @@ export interface NormalizedLwcConfig extends Omit<LwcConfig, 'interchangeableMod
137
158
  }
138
159
  export declare type ServiceEntry = [string, any?];
139
160
  export declare type ServiceConfig = string | ServiceEntry;
161
+ export declare type ResolvedServiceEntry<T extends LwrService> = [ServiceCtor<T>, any?];
140
162
  export interface BundleConfig {
141
163
  exclude?: string[];
142
164
  UNSAFE_lwrDefaultExclude?: string[];
package/build/index.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node" />
5
+ import type { WatchOptions } from 'chokidar';
5
6
  import { EventEmitter } from 'events';
6
7
  import fs from 'fs';
7
8
  import { Readable } from 'stream';
@@ -200,6 +201,11 @@ export interface BootstrapRuntimeEnvironment extends RuntimeEnvironment {
200
201
  bootstrapImports?: string[];
201
202
  bootstrapDynamicImports?: string[];
202
203
  }
204
+ export type { WatchOptions } from 'chokidar';
205
+ export interface WatcherFactory {
206
+ createFileWatcher(options?: WatchOptions): Watcher;
207
+ setupWatcher(onModuleChange: Function): Watcher;
208
+ }
203
209
  export interface Watcher extends EventEmitter {
204
210
  add(paths: string | ReadonlyArray<string>): void;
205
211
  unwatch(paths: string | ReadonlyArray<string>): void;
@@ -253,7 +259,7 @@ export interface ModuleProvider {
253
259
  }
254
260
  export declare type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
255
261
  export interface ServiceCtor<T extends LwrService, R extends Record<string, Json> = {}> {
256
- new (moduleProviderConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
262
+ new (providerConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
257
263
  }
258
264
  export interface ModuleRegistry {
259
265
  name: string;
@@ -305,6 +311,7 @@ export interface ProviderContext {
305
311
  assetRegistry: PublicAssetRegistry;
306
312
  config: ProviderAppConfig;
307
313
  runtimeEnvironment: RuntimeEnvironment;
314
+ watcherFactory?: WatcherFactory;
308
315
  }
309
316
  export interface ResourceIdentifier {
310
317
  specifier: string;
@@ -502,6 +509,7 @@ export interface ServerContext {
502
509
  assetRegistry: AssetRegistry;
503
510
  appConfig: NormalizedLwrGlobalConfig;
504
511
  runtimeEnvironment: RuntimeEnvironment;
512
+ watcherFactory?: WatcherFactory;
505
513
  }
506
514
  export interface Observer<V> {
507
515
  next: (value: V) => void;
package/build/views.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { RouteHandlerFunction, RouteHandlerView, View } from './config.js';
3
- import { AssetSource, AssetUri, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrErrorRoute, LwrRoute, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier, TransformPluginContext } from './index.js';
2
+ import { LwrErrorRoute, LwrRoute, Route, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
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 {
6
6
  name: string;
@@ -185,9 +185,9 @@ export interface ViewRegistry {
185
185
  }
186
186
  export declare type PublicViewRegistry = Pick<ViewRegistry, 'getView' | 'getViewDefinition'>;
187
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>;
188
+ getViewContent(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
189
+ getViewJson(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
190
+ getViewConfiguration(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse | undefined>;
191
191
  }
192
192
  export interface SsrRequestContext {
193
193
  props: Json;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "build": "tsc -b"
9
9
  },
10
10
  "type": "module",
11
- "version": "0.9.0-alpha.11",
11
+ "version": "0.9.0-alpha.13",
12
12
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
13
13
  "repository": {
14
14
  "type": "git",
@@ -26,5 +26,8 @@
26
26
  "engines": {
27
27
  "node": ">=14.15.4 <19"
28
28
  },
29
- "gitHead": "3cb1275b364ae7373c1868c79e6082a122dbef9c"
29
+ "devDependencies": {
30
+ "chokidar": "^3.5.3"
31
+ },
32
+ "gitHead": "fa30915a685f6e8c5c2895d0c053d59145780123"
30
33
  }