@lwrjs/types 0.15.0-alpha.3 → 0.15.0-alpha.30
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 +18 -2
- package/build/index.d.ts +8 -4
- package/build/server.d.ts +6 -1
- package/build/serviceAPI/serviceAPI.d.ts +11 -0
- package/build/views.d.ts +23 -1
- package/package.json +2 -2
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, '
|
|
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';
|
|
@@ -179,6 +179,7 @@ export interface FeatureFlags extends Record<string, boolean | string | undefine
|
|
|
179
179
|
MAX_VIEW_CACHE_TTL?: string;
|
|
180
180
|
REEVALUATE_MODULES?: boolean;
|
|
181
181
|
SINGLE_RENDER_MODE?: boolean;
|
|
182
|
+
SSR_LOADER_PER_REQUEST?: boolean;
|
|
182
183
|
}
|
|
183
184
|
export interface RuntimeEnvironment extends ServerModeConfig {
|
|
184
185
|
apiVersion: string;
|
|
@@ -191,7 +192,9 @@ export interface RuntimeEnvironment extends ServerModeConfig {
|
|
|
191
192
|
export interface SourceMapRuntimeEnvironment extends RuntimeEnvironment {
|
|
192
193
|
sourceMapUrl?: string;
|
|
193
194
|
}
|
|
194
|
-
export type RuntimeParams = Record<string, string | number | boolean | null | undefined | Record<string, string
|
|
195
|
+
export type RuntimeParams = Record<string, string | number | boolean | null | undefined | string[] | Record<string, string> | DirectToCoreProxy> & {
|
|
196
|
+
requestCache?: Record<string, any>;
|
|
197
|
+
};
|
|
195
198
|
export interface EnvironmentContext {
|
|
196
199
|
basePath: string;
|
|
197
200
|
locale: string;
|
|
@@ -317,7 +320,7 @@ export interface BundleRecord {
|
|
|
317
320
|
includedModules: string[];
|
|
318
321
|
}
|
|
319
322
|
export interface BundleDefinition extends ModuleId {
|
|
320
|
-
|
|
323
|
+
getCode: () => Promise<string>;
|
|
321
324
|
config: BundleConfig;
|
|
322
325
|
map?: any;
|
|
323
326
|
bundleRecord: BundleRecord;
|
|
@@ -341,6 +344,7 @@ export interface ProviderAppConfig {
|
|
|
341
344
|
bundleConfig: BundleConfig;
|
|
342
345
|
assets: AssetConfig[];
|
|
343
346
|
i18n: I18NConfig;
|
|
347
|
+
_isSsrCompilerEnabled: boolean;
|
|
344
348
|
}
|
|
345
349
|
export interface ProviderContext {
|
|
346
350
|
appObserver: Pick<LwrAppObserver, 'onModuleDefinitionChange' | 'onModuleSourceChange' | 'onAssetSourceChange' | 'onViewSourceChange'>;
|
|
@@ -642,7 +646,7 @@ export interface DecisionTree<Artifact extends SiteArtifact> {
|
|
|
642
646
|
/**
|
|
643
647
|
* Retrieve an artifact from the tree based on a path of decisions
|
|
644
648
|
*/
|
|
645
|
-
find(siteArtifactId: string | Partial<AbstractModuleId>, debug?: boolean, localeId?: string): Artifact | undefined;
|
|
649
|
+
find(siteArtifactId: string | Partial<AbstractModuleId>, debug?: boolean, ssr?: boolean, localeId?: string): Artifact | undefined;
|
|
646
650
|
}
|
|
647
651
|
export interface SiteMetadata {
|
|
648
652
|
/**
|
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
|
@@ -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
|
+
redirect?: SsrRedirect;
|
|
23
|
+
};
|
|
22
24
|
export interface RenderingResult {
|
|
23
25
|
renderedView: string;
|
|
24
26
|
metadata?: RenderedViewMetadata;
|
|
25
27
|
options?: RenderOptions;
|
|
26
28
|
cache?: CacheResponse;
|
|
29
|
+
redirect?: SsrRedirect;
|
|
27
30
|
}
|
|
28
31
|
export interface RenderedView extends NormalizedRenderingResult {
|
|
29
32
|
compiledView: CompiledView;
|
|
@@ -86,6 +89,7 @@ export interface LinkedViewDefinition {
|
|
|
86
89
|
viewRecord: RenderedViewRecord;
|
|
87
90
|
immutable: boolean;
|
|
88
91
|
cache?: CacheResponse;
|
|
92
|
+
redirect?: SsrRedirect;
|
|
89
93
|
nonce?: string;
|
|
90
94
|
}
|
|
91
95
|
export interface ViewRequestQs {
|
|
@@ -123,6 +127,9 @@ export interface ViewDefinitionResponse {
|
|
|
123
127
|
headers?: Record<string, string>;
|
|
124
128
|
cookie?: 'wip';
|
|
125
129
|
locale?: string;
|
|
130
|
+
metadata?: {
|
|
131
|
+
viewDefinition?: LinkedViewDefinition;
|
|
132
|
+
};
|
|
126
133
|
}
|
|
127
134
|
export interface ViewProvider {
|
|
128
135
|
name: string;
|
|
@@ -147,6 +154,7 @@ type ViewPluginLinkHook = (builder: LwrStringBuilder, viewContext: ViewTransform
|
|
|
147
154
|
type ViewPluginLinkHookReturn = void | null | undefined | false | LwrStringBuilder | {
|
|
148
155
|
builder?: LwrStringBuilder;
|
|
149
156
|
cache?: CacheResponse;
|
|
157
|
+
redirect?: SsrRedirect;
|
|
150
158
|
};
|
|
151
159
|
type ViewPluginOptimizeHook = (code: string, assetSource: AssetSource) => Promise<ViewPluginOptimizeHookReturn>;
|
|
152
160
|
type ViewPluginOptimizeHookReturn = null | undefined | false | string | {
|
|
@@ -167,6 +175,7 @@ export interface ViewInfo {
|
|
|
167
175
|
configAsSrc: boolean;
|
|
168
176
|
mixedMode: boolean;
|
|
169
177
|
nonce?: string;
|
|
178
|
+
ssr: boolean;
|
|
170
179
|
}
|
|
171
180
|
export interface RenderOptions {
|
|
172
181
|
skipMetadataCollection?: boolean;
|
|
@@ -177,9 +186,11 @@ export interface ViewPageContext {
|
|
|
177
186
|
id: string;
|
|
178
187
|
title?: string;
|
|
179
188
|
url: string;
|
|
189
|
+
assetBasePath?: string;
|
|
180
190
|
basePath?: string;
|
|
181
191
|
locale?: string;
|
|
182
192
|
nonce?: string;
|
|
193
|
+
uiBasePath?: string;
|
|
183
194
|
}
|
|
184
195
|
export type ViewModuleResourceContext = {
|
|
185
196
|
isPreload?: boolean;
|
|
@@ -212,6 +223,7 @@ export interface SsrRequestContext {
|
|
|
212
223
|
query: ViewRequestQs;
|
|
213
224
|
locale: string;
|
|
214
225
|
basePath: string;
|
|
226
|
+
crossRequestCache: Record<string, any>;
|
|
215
227
|
}
|
|
216
228
|
export interface SsrRequestOptions {
|
|
217
229
|
bundleSpecifier: string;
|
|
@@ -247,6 +259,16 @@ export interface SsrDataResponse {
|
|
|
247
259
|
}[];
|
|
248
260
|
};
|
|
249
261
|
cache?: CacheResponse;
|
|
262
|
+
redirect?: SsrRedirect;
|
|
263
|
+
}
|
|
264
|
+
export interface SsrRedirect {
|
|
265
|
+
status?: 301 | 302;
|
|
266
|
+
location: string;
|
|
267
|
+
}
|
|
268
|
+
export interface DirectToCoreProxy {
|
|
269
|
+
origin: string;
|
|
270
|
+
host?: string;
|
|
271
|
+
servername?: string;
|
|
250
272
|
}
|
|
251
273
|
export {};
|
|
252
274
|
//# 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.
|
|
11
|
+
"version": "0.15.0-alpha.30",
|
|
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": "
|
|
32
|
+
"gitHead": "b563560f1d3ccbb6d6bab8a8a5d7b6a8456b9c48"
|
|
33
33
|
}
|