@lwrjs/types 0.9.0-alpha.1 → 0.9.0-alpha.10
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 +3 -1
- package/build/index.d.ts +2 -3
- package/build/server.d.ts +15 -4
- package/build/views.d.ts +10 -1
- package/package.json +2 -2
package/build/config.d.ts
CHANGED
|
@@ -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
|
|
25
|
+
export interface NormalizedLwrErrorRoute extends LwrErrorRoute {
|
|
26
26
|
bootstrap: NormalizedLwrAppBootstrapConfig;
|
|
27
27
|
}
|
|
28
28
|
export interface LwrAppBootstrapConfig {
|
|
@@ -96,6 +96,7 @@ export interface LwrGlobalConfig {
|
|
|
96
96
|
}
|
|
97
97
|
export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig, 'lwc'>> {
|
|
98
98
|
routes: NormalizedLwrRoute[];
|
|
99
|
+
errorRoutes: NormalizedLwrErrorRoute[];
|
|
99
100
|
assets: AssetConfig[];
|
|
100
101
|
lwrVersion: string;
|
|
101
102
|
amdLoader: string;
|
|
@@ -111,6 +112,7 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
|
|
|
111
112
|
export interface StaticSiteGenerator {
|
|
112
113
|
outputDir?: string;
|
|
113
114
|
locales?: string[];
|
|
115
|
+
skipBaseDocumentGeneration?: boolean;
|
|
114
116
|
_additionalRoutePaths?: string[];
|
|
115
117
|
_additionalModules?: string[];
|
|
116
118
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
/// <reference types="node" />
|
|
5
|
-
/// <reference types="node" />
|
|
6
5
|
import { EventEmitter } from 'events';
|
|
7
6
|
import fs from 'fs';
|
|
8
|
-
import { Server } from 'http';
|
|
9
7
|
import { Readable } from 'stream';
|
|
10
8
|
import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord } from './config.js';
|
|
11
9
|
import { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
|
|
@@ -166,6 +164,7 @@ export interface ServerModeConfig {
|
|
|
166
164
|
}
|
|
167
165
|
export interface FeatureFlags {
|
|
168
166
|
LEGACY_LOADER: boolean;
|
|
167
|
+
SSR_STATIC_BUNDLES: boolean;
|
|
169
168
|
}
|
|
170
169
|
export interface RuntimeEnvironment extends ServerModeConfig {
|
|
171
170
|
apiVersion: string;
|
|
@@ -397,6 +396,7 @@ export declare type PublicResourceRegistry = Pick<ResourceRegistry, 'getResource
|
|
|
397
396
|
export interface AssetRegistry {
|
|
398
397
|
name: string;
|
|
399
398
|
addAssetProviders(provider: AssetProvider[]): void;
|
|
399
|
+
addAssetTransformers(transformers: AssetTransformPlugin[]): void;
|
|
400
400
|
getAsset<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T, includeMetadata?: boolean): Promise<AssetDefinition>;
|
|
401
401
|
resolveAssetUri<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<AssetUri>;
|
|
402
402
|
getPublicApi(): PublicAssetRegistry;
|
|
@@ -494,7 +494,6 @@ export interface MetricsConfig {
|
|
|
494
494
|
export interface ServerContext {
|
|
495
495
|
appObserver: LwrAppObserver;
|
|
496
496
|
appEmitter: LwrAppEmitter;
|
|
497
|
-
server: Server;
|
|
498
497
|
compiler: Compiler;
|
|
499
498
|
moduleRegistry: ModuleRegistry;
|
|
500
499
|
moduleBundler: ModuleBundler;
|
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
|
-
*
|
|
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
|
-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { RouteHandlerFunction, RouteHandlerView, View } from './config.js';
|
|
3
|
-
import { AssetSource, AssetUri, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier, TransformPluginContext } from './index.js';
|
|
3
|
+
import { AssetSource, AssetUri, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrErrorRoute, LwrRoute, 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;
|
|
@@ -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,7 +8,7 @@
|
|
|
8
8
|
"build": "tsc -b"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
-
"version": "0.9.0-alpha.
|
|
11
|
+
"version": "0.9.0-alpha.10",
|
|
12
12
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=14.15.4 <19"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ecbf031157dd87d2b1a3d528b7fae8f9142eba7e"
|
|
30
30
|
}
|