@lwrjs/types 0.13.0-alpha.3 → 0.13.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 +5 -1
- package/build/index.d.ts +27 -4
- package/build/lwr-shim.d.ts +1 -1
- package/build/serviceAPI/appMetadata/appMetadata.d.ts +1 -1
- package/build/serviceAPI/loaderPlugins/loaderPlugins.d.ts +1 -1
- package/build/serviceAPI/serviceAPI.d.ts +18 -6
- package/build/views.d.ts +26 -8
- 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';
|
|
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';
|
|
2
2
|
export interface View {
|
|
3
3
|
id: string;
|
|
4
4
|
rootComponent?: string;
|
|
@@ -44,6 +44,8 @@ export interface LwrAppBootstrapConfig {
|
|
|
44
44
|
mixedMode?: boolean;
|
|
45
45
|
module?: string | undefined;
|
|
46
46
|
preloadModules?: string[];
|
|
47
|
+
lwrVersion?: string;
|
|
48
|
+
lwcVersion?: string;
|
|
47
49
|
}
|
|
48
50
|
export interface NormalizedLwrAppBootstrapConfig extends Required<Omit<LwrAppBootstrapConfig, 'module'>> {
|
|
49
51
|
services: BootstrapService[];
|
|
@@ -62,6 +64,8 @@ export interface NormalizedRouteHandlersConfig {
|
|
|
62
64
|
export interface LocalizedViewRequest extends ViewRequest {
|
|
63
65
|
locale?: string;
|
|
64
66
|
basePath?: string;
|
|
67
|
+
assetBasePath?: string;
|
|
68
|
+
uiBasePath?: string;
|
|
65
69
|
}
|
|
66
70
|
export type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext, routeHandlerOptions?: any) => Promise<RouteHandlerViewResponse> | RouteHandlerViewResponse;
|
|
67
71
|
export interface ResourcePaths {
|
package/build/index.d.ts
CHANGED
|
@@ -174,6 +174,10 @@ export interface FeatureFlags extends Record<string, boolean | string | undefine
|
|
|
174
174
|
SSR_STATIC_BUNDLES?: boolean;
|
|
175
175
|
SSR_WITH_CSR_FALLBACK?: boolean;
|
|
176
176
|
EXPERIMENTAL_UNVERSIONED_ALIASES?: boolean;
|
|
177
|
+
ENABLE_NONCE?: boolean;
|
|
178
|
+
MAX_VIEW_CACHE_TTL?: string;
|
|
179
|
+
REEVALUATE_MODULES?: boolean;
|
|
180
|
+
SINGLE_RENDER_MODE?: boolean;
|
|
177
181
|
}
|
|
178
182
|
export interface RuntimeEnvironment extends ServerModeConfig {
|
|
179
183
|
apiVersion: string;
|
|
@@ -313,6 +317,7 @@ export interface BundleDefinition extends ModuleId {
|
|
|
313
317
|
map?: any;
|
|
314
318
|
bundleRecord: BundleRecord;
|
|
315
319
|
src?: string;
|
|
320
|
+
integrity?: string;
|
|
316
321
|
}
|
|
317
322
|
export interface ProviderAppConfig {
|
|
318
323
|
modules: ResolverModuleRecord[];
|
|
@@ -373,6 +378,8 @@ export interface ResourceDefinition {
|
|
|
373
378
|
content?: string;
|
|
374
379
|
stream?: () => Readable;
|
|
375
380
|
isPreload?: boolean;
|
|
381
|
+
version?: string;
|
|
382
|
+
integrity?: string;
|
|
376
383
|
}
|
|
377
384
|
export interface AssetMetadata {
|
|
378
385
|
assetReferences?: AssetReference[];
|
|
@@ -513,11 +520,8 @@ export interface ClientBootstrapConfig {
|
|
|
513
520
|
imports?: ImportMetadataImports;
|
|
514
521
|
index?: ImportMetadataIndex;
|
|
515
522
|
metricsConfig?: MetricsConfig;
|
|
516
|
-
/**
|
|
517
|
-
/* @deprecated for mapping endpoint syntax
|
|
518
|
-
/* Import map for the loader to resolve modules, defaults to a "lwr-importmap" script tag
|
|
519
|
-
*/
|
|
520
523
|
importMappings?: object;
|
|
524
|
+
env?: any;
|
|
521
525
|
}
|
|
522
526
|
export interface Endpoints {
|
|
523
527
|
uris: Record<string, string>;
|
|
@@ -624,6 +628,16 @@ export interface LwrStringBuilder {
|
|
|
624
628
|
toString(): string;
|
|
625
629
|
original: string;
|
|
626
630
|
}
|
|
631
|
+
export interface DecisionTree<Artifact extends SiteArtifact> {
|
|
632
|
+
/**
|
|
633
|
+
* Insert an artifact into the tree based on a path of decisions
|
|
634
|
+
*/
|
|
635
|
+
insert(siteArtifactId: string, artifact: Artifact, debug?: boolean, localeFallbacks?: Record<string, string[]>): void;
|
|
636
|
+
/**
|
|
637
|
+
* Retrieve an artifact from the tree based on a path of decisions
|
|
638
|
+
*/
|
|
639
|
+
find(siteArtifactId: string | Partial<AbstractModuleId>, debug?: boolean, localeId?: string): Artifact | undefined;
|
|
640
|
+
}
|
|
627
641
|
export interface SiteMetadata {
|
|
628
642
|
/**
|
|
629
643
|
* Get the path that all site metadata is relative to
|
|
@@ -655,6 +669,14 @@ export interface SiteMetadata {
|
|
|
655
669
|
* @returns
|
|
656
670
|
*/
|
|
657
671
|
persistSiteMetadata(): Promise<void>;
|
|
672
|
+
/**
|
|
673
|
+
* Get get decision tree to figure out the best site bundle to use.
|
|
674
|
+
*/
|
|
675
|
+
getSiteBundlesDecisionTree(): DecisionTree<SiteBundle>;
|
|
676
|
+
/**
|
|
677
|
+
* Get get decision tree to figure out the best site resource to use.
|
|
678
|
+
*/
|
|
679
|
+
getSiteResourcesDecisionTree(): DecisionTree<SiteResource>;
|
|
658
680
|
}
|
|
659
681
|
export interface SiteBundles {
|
|
660
682
|
bundles: Record<string, SiteBundle>;
|
|
@@ -668,6 +690,7 @@ export interface SiteAssets {
|
|
|
668
690
|
export interface SiteArtifact {
|
|
669
691
|
path: string;
|
|
670
692
|
mimeType?: string;
|
|
693
|
+
integrity?: string;
|
|
671
694
|
}
|
|
672
695
|
export interface SiteResource extends SiteArtifact {
|
|
673
696
|
inline?: boolean;
|
package/build/lwr-shim.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetProvider, HooksPlugin, ModuleProvider, ProviderContext, ResourceProvider, ViewProvider, ViewTransformPlugin } from './index';
|
|
1
|
+
import type { AssetProvider, HooksPlugin, ModuleProvider, ProviderContext, ResourceProvider, ViewProvider, ViewTransformPlugin } from './index.js';
|
|
2
2
|
interface LwrShim {
|
|
3
3
|
LWC_VERSION: string;
|
|
4
4
|
LEGACY_LOADER: boolean;
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import type { ServerData } from '../index';
|
|
2
|
-
import type { RegisterLoaderHooks } from './loaderPlugins/loaderPlugins';
|
|
3
|
-
import type { RegisterHandleStaleModuleHook } from './handleStaleModule/handleStaleModule';
|
|
4
|
-
import type { AppMetadata } from './appMetadata/appMetadata';
|
|
5
|
-
export
|
|
1
|
+
import type { ServerData } from '../index.js';
|
|
2
|
+
import type { RegisterLoaderHooks } from './loaderPlugins/loaderPlugins.js';
|
|
3
|
+
import type { RegisterHandleStaleModuleHook } from './handleStaleModule/handleStaleModule.js';
|
|
4
|
+
import type { AppMetadata } from './appMetadata/appMetadata.js';
|
|
5
|
+
export type ServerDataCallbackParams = {
|
|
6
6
|
serverData: ServerData;
|
|
7
|
+
};
|
|
8
|
+
export interface ServerDataCallback {
|
|
9
|
+
(params: ServerDataCallbackParams): void | null;
|
|
7
10
|
}
|
|
8
|
-
|
|
11
|
+
interface RegisterServerDataCallback {
|
|
12
|
+
(hook: ServerDataCallback): void;
|
|
13
|
+
}
|
|
14
|
+
export interface ServiceAPI {
|
|
9
15
|
addLoaderPlugin: NoOp | RegisterLoaderHooks;
|
|
10
16
|
handleStaleModule: RegisterHandleStaleModuleHook;
|
|
17
|
+
addServerDataCallback: RegisterServerDataCallback;
|
|
11
18
|
appMetadata: AppMetadata;
|
|
12
19
|
}
|
|
20
|
+
export interface ServerServiceAPI {
|
|
21
|
+
addLoaderPlugin: NoOp | RegisterLoaderHooks;
|
|
22
|
+
addServerDataCallback: RegisterServerDataCallback;
|
|
23
|
+
}
|
|
13
24
|
export interface NoOp {
|
|
14
25
|
(): void;
|
|
15
26
|
}
|
|
27
|
+
export {};
|
|
16
28
|
//# sourceMappingURL=serviceAPI.d.ts.map
|
package/build/views.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface CompiledView extends ViewSource {
|
|
|
16
16
|
properties?: {
|
|
17
17
|
[key: string]: unknown;
|
|
18
18
|
};
|
|
19
|
-
render: (context
|
|
19
|
+
render: (context: any, runtimeEnvironment: RuntimeEnvironment) => Promise<RenderingResult>;
|
|
20
20
|
}
|
|
21
21
|
export type NormalizedRenderingResult = Required<RenderingResult>;
|
|
22
22
|
export interface RenderingResult {
|
|
@@ -74,6 +74,7 @@ export interface RenderedViewRecord {
|
|
|
74
74
|
customElements?: CustomElementRecord[];
|
|
75
75
|
endpoints?: Endpoints;
|
|
76
76
|
importMetadata?: ImportMetadata;
|
|
77
|
+
moduleResources: ResourceDefinition[];
|
|
77
78
|
bootstrapModule?: {
|
|
78
79
|
specifier: Specifier;
|
|
79
80
|
flatGraph: FlattenedModuleGraphs;
|
|
@@ -85,6 +86,7 @@ export interface LinkedViewDefinition {
|
|
|
85
86
|
viewRecord: RenderedViewRecord;
|
|
86
87
|
immutable: boolean;
|
|
87
88
|
cache?: CacheResponse;
|
|
89
|
+
nonce?: string;
|
|
88
90
|
}
|
|
89
91
|
export interface ViewRequestQs {
|
|
90
92
|
[key: string]: undefined | string | string[];
|
|
@@ -109,6 +111,7 @@ export interface ViewResponse {
|
|
|
109
111
|
metadata?: {
|
|
110
112
|
viewDefinition?: LinkedViewDefinition;
|
|
111
113
|
};
|
|
114
|
+
locale?: string;
|
|
112
115
|
}
|
|
113
116
|
export type RouteHandlerViewResponse = ViewDefinitionResponse | ViewResponse;
|
|
114
117
|
export interface ViewDefinitionResponse {
|
|
@@ -119,6 +122,7 @@ export interface ViewDefinitionResponse {
|
|
|
119
122
|
cache?: CacheResponse;
|
|
120
123
|
headers?: Record<string, string>;
|
|
121
124
|
cookie?: 'wip';
|
|
125
|
+
locale?: string;
|
|
122
126
|
}
|
|
123
127
|
export interface ViewProvider {
|
|
124
128
|
name: string;
|
|
@@ -162,11 +166,11 @@ export interface ViewInfo {
|
|
|
162
166
|
url: string;
|
|
163
167
|
configAsSrc: boolean;
|
|
164
168
|
mixedMode: boolean;
|
|
169
|
+
nonce?: string;
|
|
165
170
|
}
|
|
166
171
|
export interface RenderOptions {
|
|
167
172
|
skipMetadataCollection?: boolean;
|
|
168
173
|
freezeAssets?: boolean;
|
|
169
|
-
skipCaching?: boolean;
|
|
170
174
|
viewParamCacheKey?: Json;
|
|
171
175
|
}
|
|
172
176
|
export interface ViewPageContext {
|
|
@@ -175,17 +179,20 @@ export interface ViewPageContext {
|
|
|
175
179
|
url: string;
|
|
176
180
|
basePath?: string;
|
|
177
181
|
locale?: string;
|
|
182
|
+
nonce?: string;
|
|
178
183
|
}
|
|
179
184
|
export type ViewModuleResourceContext = {
|
|
180
185
|
isPreload?: boolean;
|
|
181
186
|
isSSR?: boolean;
|
|
182
187
|
async?: boolean;
|
|
188
|
+
nonce?: string;
|
|
189
|
+
integrity?: string;
|
|
183
190
|
};
|
|
184
191
|
export interface ViewRegistry {
|
|
185
192
|
addViewProviders(providers: ViewProvider[]): void;
|
|
186
193
|
addViewTransformers(transformers: ViewTransformPlugin[]): void;
|
|
187
194
|
initializeViewProviders(): Promise<void[]>;
|
|
188
|
-
getView(viewId: ViewIdentity
|
|
195
|
+
getView(viewId: ViewIdentity): Promise<CompiledView>;
|
|
189
196
|
getViewDefinition<R extends RuntimeEnvironment>(view: View, viewParams: ViewParams, runtimeEnvironment: R, runtimeParams?: RuntimeParams, renderOptions?: RenderOptions): Promise<LinkedViewDefinition>;
|
|
190
197
|
hasViewDefinition<R extends RuntimeEnvironment>(view: View, viewParams: ViewParams, runtimeEnvironment: R, runtimeParams?: RuntimeParams, renderOptions?: RenderOptions): boolean;
|
|
191
198
|
getPublicApi(): PublicViewRegistry;
|
|
@@ -212,17 +219,28 @@ export interface SsrRequestOptions {
|
|
|
212
219
|
host?: string;
|
|
213
220
|
requestDepth?: number;
|
|
214
221
|
}
|
|
222
|
+
export type MetaTag = {
|
|
223
|
+
name?: string;
|
|
224
|
+
httpEquiv?: string;
|
|
225
|
+
content?: string;
|
|
226
|
+
};
|
|
227
|
+
export type LinkTag = {
|
|
228
|
+
href: string;
|
|
229
|
+
as?: string;
|
|
230
|
+
rel?: string;
|
|
231
|
+
fetchpriority?: 'high' | 'low' | 'auto';
|
|
232
|
+
};
|
|
215
233
|
export interface SsrDataResponse {
|
|
216
234
|
props?: {
|
|
217
235
|
[prop: string]: Json;
|
|
218
236
|
};
|
|
219
237
|
markup?: {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
fetchpriority?: 'high' | 'low' | 'auto';
|
|
238
|
+
title?: string;
|
|
239
|
+
meta?: MetaTag[];
|
|
240
|
+
scripts?: {
|
|
241
|
+
body: string;
|
|
225
242
|
}[];
|
|
243
|
+
links?: LinkTag[];
|
|
226
244
|
};
|
|
227
245
|
cache?: CacheResponse;
|
|
228
246
|
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "tsc -b"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
-
"version": "0.13.0-alpha.
|
|
11
|
+
"version": "0.13.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": "8bf14ed00a95675fdb506e2cbdb6033324bf95bf"
|
|
33
33
|
}
|