@lwrjs/types 0.12.0-alpha.2 → 0.12.0-alpha.20
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 +17 -3
- package/build/lwr-shim.d.ts +8 -0
- package/build/server.d.ts +4 -1
- package/build/views.d.ts +11 -4
- package/package.json +3 -3
package/build/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, ServiceCtor, Specifier, UriTransformPlugin, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
|
|
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';
|
|
2
2
|
export interface View {
|
|
3
3
|
id: string;
|
|
4
4
|
rootComponent?: string;
|
|
@@ -40,6 +40,7 @@ export interface LwrAppBootstrapConfig {
|
|
|
40
40
|
services?: (string | BootstrapService)[];
|
|
41
41
|
configAsSrc?: boolean;
|
|
42
42
|
ssr?: boolean;
|
|
43
|
+
preloadData?: boolean;
|
|
43
44
|
mixedMode?: boolean;
|
|
44
45
|
module?: string | undefined;
|
|
45
46
|
preloadModules?: string[];
|
|
@@ -60,6 +61,7 @@ export interface NormalizedRouteHandlersConfig {
|
|
|
60
61
|
}
|
|
61
62
|
export interface LocalizedViewRequest extends ViewRequest {
|
|
62
63
|
locale?: string;
|
|
64
|
+
basePath?: string;
|
|
63
65
|
}
|
|
64
66
|
export type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext, routeHandlerOptions?: any) => Promise<RouteHandlerViewResponse> | RouteHandlerViewResponse;
|
|
65
67
|
export interface ResourcePaths {
|
|
@@ -242,6 +244,9 @@ export interface InterchangeableModuleRecord {
|
|
|
242
244
|
[target: string]: string;
|
|
243
245
|
};
|
|
244
246
|
}
|
|
247
|
+
export interface Instrumentation {
|
|
248
|
+
flush(): void;
|
|
249
|
+
}
|
|
245
250
|
export interface HooksPlugin {
|
|
246
251
|
/**
|
|
247
252
|
* Programmatically modify application and runtime configurations.
|
|
@@ -268,7 +273,7 @@ export interface HooksPlugin {
|
|
|
268
273
|
* - When running LWR server, these hooks are invoked after `initConfigs` hooks and before `onStart` hooks
|
|
269
274
|
* - When running LWR handler, these hooks are invoked before config normalization and `onStart` hooks
|
|
270
275
|
*/
|
|
271
|
-
initInstrumentation?: () =>
|
|
276
|
+
initInstrumentation?: () => Instrumentation;
|
|
272
277
|
/**
|
|
273
278
|
* Set a subset of LWR Configuration at runtime. Works in mrt
|
|
274
279
|
*
|
|
@@ -280,6 +285,15 @@ export interface HooksPlugin {
|
|
|
280
285
|
* For the `createHandler` runtime, these hooks are invoked during server context initialization.
|
|
281
286
|
*/
|
|
282
287
|
onStart?: (config: OnStartConfig) => void;
|
|
288
|
+
/**
|
|
289
|
+
*
|
|
290
|
+
* Attach instantiated route handlers, providers, and transformers directly to the server context.
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
* This is a temporary hook to enable a tactical solution for LWR@MRT local development
|
|
294
|
+
*
|
|
295
|
+
*/
|
|
296
|
+
setupServerContext?: (context: ServerContext, startHooks: HooksPlugin[]) => Promise<void> | void;
|
|
283
297
|
}
|
|
284
298
|
export interface Locale {
|
|
285
299
|
id: string;
|
|
@@ -290,6 +304,6 @@ export interface I18NConfig {
|
|
|
290
304
|
locales: Locale[];
|
|
291
305
|
uriPattern?: UriPattern;
|
|
292
306
|
}
|
|
293
|
-
export type UriPattern = undefined | 'path-prefix'
|
|
307
|
+
export type UriPattern = undefined | 'path-prefix';
|
|
294
308
|
export {};
|
|
295
309
|
//# sourceMappingURL=config.d.ts.map
|
package/build/lwr-shim.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ interface LwrShim {
|
|
|
8
8
|
getResourceProviders(context: Partial<ProviderContext>): ResourceProvider[];
|
|
9
9
|
getViewProviders(context: Partial<ProviderContext>): ViewProvider[];
|
|
10
10
|
getViewTransformers(context: Partial<ProviderContext>): ViewTransformPlugin[];
|
|
11
|
+
env: GlobalThisEnvironment;
|
|
12
|
+
}
|
|
13
|
+
export interface GlobalThisEnvironment {
|
|
14
|
+
SSR: string | undefined;
|
|
15
|
+
basePath: string | undefined;
|
|
16
|
+
locale: string | undefined;
|
|
17
|
+
assetBasePath: string | undefined;
|
|
18
|
+
uiBasePath: string | undefined;
|
|
11
19
|
}
|
|
12
20
|
declare global {
|
|
13
21
|
const LWR: LwrShim | undefined;
|
package/build/server.d.ts
CHANGED
|
@@ -34,7 +34,6 @@ export interface InternalAppServer<T extends ServerTypes> {
|
|
|
34
34
|
initRoutes(): void;
|
|
35
35
|
getRegexWildcard(): string;
|
|
36
36
|
}
|
|
37
|
-
export type PublicAppServer<T extends ServerTypes> = Pick<InternalAppServer<T>, 'use' | 'all' | 'get' | 'post' | 'getRegexWildcard'>;
|
|
38
37
|
export type InternalAppServerOptions = {
|
|
39
38
|
app?: ServerTypeImpl<ServerTypes>;
|
|
40
39
|
basePath?: string;
|
|
@@ -82,6 +81,10 @@ export interface MiddlewareRequest {
|
|
|
82
81
|
* Return true when the environment path parameter exists and is supported
|
|
83
82
|
*/
|
|
84
83
|
validateEnvironmentRequest(config: NormalizedLwrGlobalConfig): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Return true when the api version path parameter exists and is supported
|
|
86
|
+
*/
|
|
87
|
+
validateApiVersion(config: NormalizedLwrGlobalConfig): boolean;
|
|
85
88
|
/**
|
|
86
89
|
* Use the request parameters to resolve the runtime context(ie. environment and parameters)
|
|
87
90
|
*/
|
package/build/views.d.ts
CHANGED
|
@@ -23,12 +23,10 @@ export interface RenderingResult {
|
|
|
23
23
|
renderedView: string;
|
|
24
24
|
metadata?: RenderedViewMetadata;
|
|
25
25
|
options?: RenderOptions;
|
|
26
|
+
cache?: CacheResponse;
|
|
26
27
|
}
|
|
27
|
-
export interface RenderedView {
|
|
28
|
+
export interface RenderedView extends NormalizedRenderingResult {
|
|
28
29
|
compiledView: CompiledView;
|
|
29
|
-
renderedView: string;
|
|
30
|
-
metadata: RenderedViewMetadata;
|
|
31
|
-
options: RenderOptions;
|
|
32
30
|
}
|
|
33
31
|
export interface CustomElementReference {
|
|
34
32
|
tagName: string;
|
|
@@ -128,6 +126,9 @@ export interface ViewProvider {
|
|
|
128
126
|
getView(viewId: ViewIdentity): Promise<CompiledView | undefined>;
|
|
129
127
|
}
|
|
130
128
|
export interface ViewTransformPluginContext {
|
|
129
|
+
config: {
|
|
130
|
+
cacheDir: string;
|
|
131
|
+
};
|
|
131
132
|
view: View;
|
|
132
133
|
viewParams: ViewParams;
|
|
133
134
|
runtimeEnvironment: RuntimeEnvironment;
|
|
@@ -205,6 +206,12 @@ export interface SsrRequestContext {
|
|
|
205
206
|
locale: string;
|
|
206
207
|
basePath: string;
|
|
207
208
|
}
|
|
209
|
+
export interface SsrRequestOptions {
|
|
210
|
+
bundleSpecifier: string;
|
|
211
|
+
cacheDir: string;
|
|
212
|
+
host?: string;
|
|
213
|
+
requestDepth?: number;
|
|
214
|
+
}
|
|
208
215
|
export interface SsrDataResponse {
|
|
209
216
|
props?: {
|
|
210
217
|
[prop: string]: Json;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "tsc -b"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
-
"version": "0.12.0-alpha.
|
|
11
|
+
"version": "0.12.0-alpha.20",
|
|
12
12
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"build/**/*.d.ts"
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"chokidar": "^3.
|
|
27
|
+
"chokidar": "^3.6.0"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=18.0.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "ae1793e34eaf4e9b97996d7aea9031908b23a13a"
|
|
33
33
|
}
|