@lwrjs/types 0.15.0-alpha.9 → 0.15.1

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/cli.d.ts CHANGED
@@ -36,6 +36,8 @@ export interface LocalDevOptions {
36
36
  logLevel?: string;
37
37
  open?: boolean;
38
38
  siteZip?: string;
39
+ authToken?: string;
40
+ sfCLI?: boolean;
39
41
  writeSrcFilesToBundle?: boolean;
40
42
  inlineUpdate?: boolean;
41
43
  regenerateAllRoutes?: boolean;
package/build/config.d.ts CHANGED
@@ -1,4 +1,4 @@
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.js';
1
+ import type { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, DirectToCoreProxy, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerContext, ServerTypes, ServiceCtor, Specifier, UriTransformPlugin, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index.js';
2
2
  export interface View {
3
3
  id: string;
4
4
  rootComponent?: string;
@@ -30,6 +30,7 @@ export interface NormalizedLwrErrorRoute extends LwrErrorRoute {
30
30
  export interface BootstrapService {
31
31
  name: string;
32
32
  ssr: boolean;
33
+ version?: string;
33
34
  }
34
35
  export interface LwrAppBootstrapConfig {
35
36
  autoBoot?: boolean;
@@ -41,11 +42,14 @@ export interface LwrAppBootstrapConfig {
41
42
  configAsSrc?: boolean;
42
43
  ssr?: boolean;
43
44
  preloadData?: boolean;
45
+ proxyForSSR?: boolean;
46
+ includeCookiesForSSR?: boolean;
44
47
  mixedMode?: boolean;
45
48
  module?: string | undefined;
46
49
  preloadModules?: string[];
47
50
  lwrVersion?: string;
48
51
  lwcVersion?: string;
52
+ preloadResources?: PreloadResources;
49
53
  }
50
54
  export interface NormalizedLwrAppBootstrapConfig extends Required<Omit<LwrAppBootstrapConfig, 'module'>> {
51
55
  services: BootstrapService[];
@@ -111,6 +115,7 @@ export interface LwrGlobalConfig {
111
115
  resourceProviders?: ServiceConfig[];
112
116
  viewProviders?: ServiceConfig[];
113
117
  viewTransformers?: ServiceConfig[];
118
+ caseSensitiveRoutes?: boolean;
114
119
  routes?: LwrRoute[];
115
120
  errorRoutes?: LwrErrorRoute[];
116
121
  routeHandlers?: RouteHandlersConfig;
@@ -120,11 +125,14 @@ export interface LwrGlobalConfig {
120
125
  locker?: LwrLockerConfig;
121
126
  uriTransformers?: ServiceConfig[];
122
127
  i18n?: I18NConfig;
128
+ coreProxy?: DirectToCoreProxy | null;
129
+ unsafeEnableViewLinkCaching?: boolean;
130
+ _isSsrCompilerEnabled?: boolean;
123
131
  }
124
132
  type RequiredPick<T, K extends keyof T> = {
125
133
  [P in K]-?: T[P];
126
134
  };
127
- export type OnStartConfig = RequiredPick<LwrGlobalConfig, 'basePath' | 'i18n' | 'routes' | 'errorRoutes'>;
135
+ export type OnStartConfig = RequiredPick<LwrGlobalConfig, '_isSsrCompilerEnabled' | 'assets' | 'basePath' | 'coreProxy' | 'errorRoutes' | 'i18n' | 'routes'>;
128
136
  export interface BuildOptions {
129
137
  target?: string;
130
138
  input?: string;
@@ -310,7 +318,15 @@ export interface I18NConfig {
310
318
  defaultLocale: string;
311
319
  locales: Locale[];
312
320
  uriPattern?: UriPattern;
321
+ defaultRedirectParams?: Record<string, string>;
313
322
  }
314
323
  export type UriPattern = undefined | 'path-prefix';
324
+ export interface PreloadResources {
325
+ patterns: PreloadResourcePatterns[];
326
+ }
327
+ export interface PreloadResourcePatterns {
328
+ match: string | string[];
329
+ attributes?: Record<string, string>;
330
+ }
315
331
  export {};
316
332
  //# sourceMappingURL=config.d.ts.map
package/build/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { EventEmitter } from 'events';
7
7
  import type fs from 'fs';
8
8
  import type { Readable } from 'stream';
9
9
  import type { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers, AssetConfig, I18NConfig, ModuleRegistryConfig } from './config.js';
10
- import type { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
10
+ import type { AssetReference, CompiledView, DirectToCoreProxy, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
11
11
  export * from './lwr-shim.js';
12
12
  export * from './config.js';
13
13
  export * from './cli.js';
@@ -169,16 +169,19 @@ export interface ServerModeConfig {
169
169
  };
170
170
  featureFlags: FeatureFlags;
171
171
  }
172
- export interface FeatureFlags extends Record<string, boolean | string | undefined> {
172
+ export interface FeatureFlags extends Record<string, boolean | string | Record<string, string> | undefined> {
173
173
  ASSETS_ON_LAMBDA?: boolean;
174
+ BUNDLE_CACHE_SIZE?: string;
174
175
  LEGACY_LOADER?: boolean;
175
- SSR_STATIC_BUNDLES?: boolean;
176
176
  SSR_WITH_CSR_FALLBACK?: boolean;
177
177
  EXPERIMENTAL_UNVERSIONED_ALIASES?: boolean;
178
178
  ENABLE_NONCE?: boolean;
179
179
  MAX_VIEW_CACHE_TTL?: string;
180
180
  REEVALUATE_MODULES?: boolean;
181
- SINGLE_RENDER_MODE?: boolean;
181
+ SSR_LOADER_PER_REQUEST?: boolean;
182
+ EXPERIMENTAL_ASSET_HEADERS?: string;
183
+ SSR_COMPILER_ENABLED?: boolean;
184
+ VIEW_CACHE_SIZE?: string;
182
185
  }
183
186
  export interface RuntimeEnvironment extends ServerModeConfig {
184
187
  apiVersion: string;
@@ -191,7 +194,9 @@ export interface RuntimeEnvironment extends ServerModeConfig {
191
194
  export interface SourceMapRuntimeEnvironment extends RuntimeEnvironment {
192
195
  sourceMapUrl?: string;
193
196
  }
194
- export type RuntimeParams = Record<string, string | number | boolean | null | undefined | Record<string, string>>;
197
+ export type RuntimeParams = Record<string, string | number | boolean | null | undefined | string[] | Record<string, string> | DirectToCoreProxy> & {
198
+ requestCache?: Record<string, any>;
199
+ };
195
200
  export interface EnvironmentContext {
196
201
  basePath: string;
197
202
  locale: string;
@@ -317,7 +322,7 @@ export interface BundleRecord {
317
322
  includedModules: string[];
318
323
  }
319
324
  export interface BundleDefinition extends ModuleId {
320
- code: string;
325
+ getCode: () => Promise<string>;
321
326
  config: BundleConfig;
322
327
  map?: any;
323
328
  bundleRecord: BundleRecord;
@@ -642,7 +647,7 @@ export interface DecisionTree<Artifact extends SiteArtifact> {
642
647
  /**
643
648
  * Retrieve an artifact from the tree based on a path of decisions
644
649
  */
645
- find(siteArtifactId: string | Partial<AbstractModuleId>, debug?: boolean, localeId?: string): Artifact | undefined;
650
+ find(siteArtifactId: string | Partial<AbstractModuleId>, debug?: boolean, ssr?: boolean, localeId?: string): Artifact | undefined;
646
651
  }
647
652
  export interface SiteMetadata {
648
653
  /**
package/build/server.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { Application as ExpressApp } from 'express';
4
4
  import type { default as Koa, Context } from 'koa';
5
5
  import type http from 'http';
6
6
  import type { Readable } from 'stream';
7
- import type { NormalizedLwrGlobalConfig, RuntimeContext, RuntimeEnvironment } from './index.js';
7
+ import type { DirectToCoreProxy, NormalizedLwrGlobalConfig, RuntimeContext, RuntimeEnvironment } from './index.js';
8
8
  export type ServerTypes = 'koa' | 'express' | 'fs';
9
9
  export 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
  export type InternalAppServerOptions = {
38
38
  app?: ServerTypeImpl<ServerTypes>;
39
39
  basePath?: string;
40
+ caseSensitiveRoutes?: boolean;
40
41
  };
41
42
  export interface InternalAppServerConstructable {
42
43
  new (options: InternalAppServerOptions): InternalAppServer<ServerTypes>;
@@ -89,6 +90,10 @@ export interface MiddlewareRequest {
89
90
  * Use the request parameters to resolve the runtime context(ie. environment and parameters)
90
91
  */
91
92
  getRuntimeContext(defaultRuntimeEnvironment: RuntimeEnvironment): RuntimeContext;
93
+ /**
94
+ * Resolve the Direct-to-Core proxy values for the SSR wrapped fetch endowment
95
+ */
96
+ getCoreProxy(appCoreProxy?: DirectToCoreProxy, proxyForSSR?: boolean): DirectToCoreProxy | undefined;
92
97
  }
93
98
  export interface MiddlewareResponse {
94
99
  hasHeader(name: string): boolean;
@@ -11,6 +11,16 @@ export interface ServerDataCallback {
11
11
  interface RegisterServerDataCallback {
12
12
  (hook: ServerDataCallback): void;
13
13
  }
14
+ export type RequestHookParams = {
15
+ cookies: RequestHookCookies;
16
+ };
17
+ export type RequestHookCookies = Record<string, string> | null;
18
+ export interface RequestHook {
19
+ (params: RequestHookParams): void | null;
20
+ }
21
+ interface RegisterRequestHook {
22
+ (hook: RequestHook): void;
23
+ }
14
24
  export interface ServiceAPI {
15
25
  addLoaderPlugin: NoOp | RegisterLoaderHooks;
16
26
  handleStaleModule: RegisterHandleStaleModuleHook;
@@ -20,6 +30,7 @@ export interface ServiceAPI {
20
30
  export interface ServerServiceAPI {
21
31
  addLoaderPlugin: NoOp | RegisterLoaderHooks;
22
32
  addServerDataCallback: RegisterServerDataCallback;
33
+ addRequestHook: RegisterRequestHook;
23
34
  }
24
35
  export interface NoOp {
25
36
  (): void;
package/build/views.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { LwrErrorRoute, LwrRoute, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
3
- import type { AssetSource, UriDefinition, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier, ServerData } from './index.js';
3
+ import type { AssetSource, BundleDefinition, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier, ServerData, UriDefinition } from './index.js';
4
4
  export type ViewIdentity = Pick<View, 'id' | 'rootComponent' | 'contentTemplate'>;
5
5
  export interface ViewSource {
6
6
  name: string;
@@ -18,12 +18,15 @@ export interface CompiledView extends ViewSource {
18
18
  };
19
19
  render: (context: any, runtimeEnvironment: RuntimeEnvironment) => Promise<RenderingResult>;
20
20
  }
21
- export type NormalizedRenderingResult = Required<RenderingResult>;
21
+ export type NormalizedRenderingResult = Required<Pick<RenderingResult, 'renderedView' | 'metadata' | 'options' | 'cache'>> & {
22
+ status?: SsrStatus;
23
+ };
22
24
  export interface RenderingResult {
23
25
  renderedView: string;
24
26
  metadata?: RenderedViewMetadata;
25
27
  options?: RenderOptions;
26
28
  cache?: CacheResponse;
29
+ status?: SsrStatus;
27
30
  }
28
31
  export interface RenderedView extends NormalizedRenderingResult {
29
32
  compiledView: CompiledView;
@@ -42,6 +45,7 @@ export interface CustomElementReference {
42
45
  export interface RenderedViewMetadata {
43
46
  customElements: CustomElementReference[];
44
47
  assetReferences: AssetReference[];
48
+ serverBundles?: Set<BundleDefinition>;
45
49
  serverData?: ServerData;
46
50
  serverDebug?: {
47
51
  message?: string;
@@ -55,15 +59,11 @@ export interface RenderedAssetReference {
55
59
  export interface AssetReference extends RenderedAssetReference {
56
60
  importer?: string;
57
61
  relative: boolean;
58
- location: {
62
+ location?: {
59
63
  startOffset: number;
60
64
  endOffset: number;
61
65
  };
62
66
  }
63
- export interface LinkedViewDefinitionMetaData {
64
- customElements: string[];
65
- assetReferences: RenderedAssetReference[];
66
- }
67
67
  export interface CustomElementRecord {
68
68
  elementName: string;
69
69
  flatGraph: FlattenedModuleGraphs;
@@ -72,6 +72,7 @@ export interface RenderedViewRecord {
72
72
  resources?: ResourceDefinition[];
73
73
  assetReferences?: RenderedAssetReference[];
74
74
  customElements?: CustomElementRecord[];
75
+ serverBundles?: Set<BundleDefinition>;
75
76
  endpoints?: Endpoints;
76
77
  importMetadata?: ImportMetadata;
77
78
  moduleResources: ResourceDefinition[];
@@ -86,6 +87,7 @@ export interface LinkedViewDefinition {
86
87
  viewRecord: RenderedViewRecord;
87
88
  immutable: boolean;
88
89
  cache?: CacheResponse;
90
+ status?: SsrStatus;
89
91
  nonce?: string;
90
92
  }
91
93
  export interface ViewRequestQs {
@@ -123,6 +125,9 @@ export interface ViewDefinitionResponse {
123
125
  headers?: Record<string, string>;
124
126
  cookie?: 'wip';
125
127
  locale?: string;
128
+ metadata?: {
129
+ viewDefinition?: LinkedViewDefinition;
130
+ };
126
131
  }
127
132
  export interface ViewProvider {
128
133
  name: string;
@@ -147,6 +152,8 @@ type ViewPluginLinkHook = (builder: LwrStringBuilder, viewContext: ViewTransform
147
152
  type ViewPluginLinkHookReturn = void | null | undefined | false | LwrStringBuilder | {
148
153
  builder?: LwrStringBuilder;
149
154
  cache?: CacheResponse;
155
+ status?: SsrStatus;
156
+ serverBundles?: Set<BundleDefinition>;
150
157
  };
151
158
  type ViewPluginOptimizeHook = (code: string, assetSource: AssetSource) => Promise<ViewPluginOptimizeHookReturn>;
152
159
  type ViewPluginOptimizeHookReturn = null | undefined | false | string | {
@@ -167,6 +174,7 @@ export interface ViewInfo {
167
174
  configAsSrc: boolean;
168
175
  mixedMode: boolean;
169
176
  nonce?: string;
177
+ ssr: boolean;
170
178
  }
171
179
  export interface RenderOptions {
172
180
  skipMetadataCollection?: boolean;
@@ -177,9 +185,11 @@ export interface ViewPageContext {
177
185
  id: string;
178
186
  title?: string;
179
187
  url: string;
188
+ assetBasePath?: string;
180
189
  basePath?: string;
181
190
  locale?: string;
182
191
  nonce?: string;
192
+ uiBasePath?: string;
183
193
  }
184
194
  export type ViewModuleResourceContext = {
185
195
  isPreload?: boolean;
@@ -212,6 +222,7 @@ export interface SsrRequestContext {
212
222
  query: ViewRequestQs;
213
223
  locale: string;
214
224
  basePath: string;
225
+ crossRequestCache: Record<string, any>;
215
226
  }
216
227
  export interface SsrRequestOptions {
217
228
  bundleSpecifier: string;
@@ -247,6 +258,16 @@ export interface SsrDataResponse {
247
258
  }[];
248
259
  };
249
260
  cache?: CacheResponse;
261
+ status?: SsrStatus;
262
+ }
263
+ export interface SsrStatus {
264
+ code: 301 | 302 | 429 | 503;
265
+ location?: string;
266
+ }
267
+ export interface DirectToCoreProxy {
268
+ origin: string;
269
+ host?: string;
270
+ servername?: string;
250
271
  }
251
272
  export {};
252
273
  //# sourceMappingURL=views.d.ts.map
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "build": "tsc -b"
9
9
  },
10
10
  "type": "module",
11
- "version": "0.15.0-alpha.9",
11
+ "version": "0.15.1",
12
12
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
13
13
  "repository": {
14
14
  "type": "git",
@@ -29,5 +29,5 @@
29
29
  "engines": {
30
30
  "node": ">=18.0.0"
31
31
  },
32
- "gitHead": "9783b817b11c29ca385457683fcb87e8179f7902"
32
+ "gitHead": "9ae4002fdab4f55caea2f8de8a7139a6b64ebad1"
33
33
  }