@lwrjs/types 0.12.0-alpha.9 → 0.13.0-alpha.0
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 +9 -5
- package/build/lwr-shim.d.ts +8 -0
- package/build/server.d.ts +0 -1
- package/build/views.d.ts +9 -0
- 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;
|
|
@@ -61,6 +61,7 @@ export interface NormalizedRouteHandlersConfig {
|
|
|
61
61
|
}
|
|
62
62
|
export interface LocalizedViewRequest extends ViewRequest {
|
|
63
63
|
locale?: string;
|
|
64
|
+
basePath?: string;
|
|
64
65
|
}
|
|
65
66
|
export type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext, routeHandlerOptions?: any) => Promise<RouteHandlerViewResponse> | RouteHandlerViewResponse;
|
|
66
67
|
export interface ResourcePaths {
|
|
@@ -214,6 +215,9 @@ export interface BundleConfig {
|
|
|
214
215
|
alias?: Record<string, string>;
|
|
215
216
|
groups?: BundleGroups;
|
|
216
217
|
}
|
|
218
|
+
export interface ModuleRegistryConfig {
|
|
219
|
+
bundleConfig: BundleConfig;
|
|
220
|
+
}
|
|
217
221
|
export interface BundleConfigOverrides extends BundleConfig {
|
|
218
222
|
appendExcludes?: boolean;
|
|
219
223
|
}
|
|
@@ -243,6 +247,9 @@ export interface InterchangeableModuleRecord {
|
|
|
243
247
|
[target: string]: string;
|
|
244
248
|
};
|
|
245
249
|
}
|
|
250
|
+
export interface Instrumentation {
|
|
251
|
+
flush(): void;
|
|
252
|
+
}
|
|
246
253
|
export interface HooksPlugin {
|
|
247
254
|
/**
|
|
248
255
|
* Programmatically modify application and runtime configurations.
|
|
@@ -269,7 +276,7 @@ export interface HooksPlugin {
|
|
|
269
276
|
* - When running LWR server, these hooks are invoked after `initConfigs` hooks and before `onStart` hooks
|
|
270
277
|
* - When running LWR handler, these hooks are invoked before config normalization and `onStart` hooks
|
|
271
278
|
*/
|
|
272
|
-
initInstrumentation?: () =>
|
|
279
|
+
initInstrumentation?: () => Instrumentation;
|
|
273
280
|
/**
|
|
274
281
|
* Set a subset of LWR Configuration at runtime. Works in mrt
|
|
275
282
|
*
|
|
@@ -281,6 +288,15 @@ export interface HooksPlugin {
|
|
|
281
288
|
* For the `createHandler` runtime, these hooks are invoked during server context initialization.
|
|
282
289
|
*/
|
|
283
290
|
onStart?: (config: OnStartConfig) => void;
|
|
291
|
+
/**
|
|
292
|
+
*
|
|
293
|
+
* Attach instantiated route handlers, providers, and transformers directly to the server context.
|
|
294
|
+
*
|
|
295
|
+
* @remarks
|
|
296
|
+
* This is a temporary hook to enable a tactical solution for LWR@MRT local development
|
|
297
|
+
*
|
|
298
|
+
*/
|
|
299
|
+
setupServerContext?: (context: ServerContext, startHooks: HooksPlugin[]) => Promise<void> | void;
|
|
284
300
|
}
|
|
285
301
|
export interface Locale {
|
|
286
302
|
id: string;
|
package/build/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { WatchOptions } from 'chokidar';
|
|
|
6
6
|
import type { EventEmitter } from 'events';
|
|
7
7
|
import type fs from 'fs';
|
|
8
8
|
import type { Readable } from 'stream';
|
|
9
|
-
import type { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers, AssetConfig, I18NConfig } from './config.js';
|
|
9
|
+
import type { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers, AssetConfig, I18NConfig, ModuleRegistryConfig } from './config.js';
|
|
10
10
|
import type { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
|
|
11
11
|
export * from './lwr-shim.js';
|
|
12
12
|
export * from './config.js';
|
|
@@ -73,6 +73,7 @@ interface BaseModuleEntry {
|
|
|
73
73
|
id: string;
|
|
74
74
|
entry: string;
|
|
75
75
|
virtual?: boolean;
|
|
76
|
+
external?: boolean;
|
|
76
77
|
scope?: string;
|
|
77
78
|
specifier: Specifier;
|
|
78
79
|
version: Version;
|
|
@@ -92,6 +93,8 @@ export interface BaseModuleReference {
|
|
|
92
93
|
specifier: string;
|
|
93
94
|
version: Version;
|
|
94
95
|
interchangeable?: boolean;
|
|
96
|
+
externalSrc?: string;
|
|
97
|
+
external?: boolean;
|
|
95
98
|
}
|
|
96
99
|
export interface ImportModuleReference extends BaseModuleReference {
|
|
97
100
|
sourceSpecifier: Specifier;
|
|
@@ -134,7 +137,7 @@ export interface ModuleDefinition extends ModuleCompiled {
|
|
|
134
137
|
export interface LinkedModuleDefinitionConfig {
|
|
135
138
|
minified: boolean;
|
|
136
139
|
}
|
|
137
|
-
export interface LinkedModuleDefinition extends ModuleDefinition {
|
|
140
|
+
export interface LinkedModuleDefinition extends ModuleDefinition, BaseModuleReference {
|
|
138
141
|
linkedSource: string;
|
|
139
142
|
linkedModuleRecord: ModuleRecord;
|
|
140
143
|
linkedConfig: LinkedModuleDefinitionConfig;
|
|
@@ -168,7 +171,6 @@ export interface ServerModeConfig {
|
|
|
168
171
|
export interface FeatureFlags extends Record<string, boolean | string | undefined> {
|
|
169
172
|
ASSETS_ON_LAMBDA?: boolean;
|
|
170
173
|
LEGACY_LOADER?: boolean;
|
|
171
|
-
SSR_SANDBOX_VM?: boolean;
|
|
172
174
|
SSR_STATIC_BUNDLES?: boolean;
|
|
173
175
|
SSR_WITH_CSR_FALLBACK?: boolean;
|
|
174
176
|
EXPERIMENTAL_UNVERSIONED_ALIASES?: boolean;
|
|
@@ -283,9 +285,10 @@ export interface ModuleRegistry {
|
|
|
283
285
|
getModuleEntry(moduleId: AbstractModuleId, runtimeParams?: RuntimeParams): Promise<ModuleEntry>;
|
|
284
286
|
resolveModuleUri<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: R, runtimeParams?: RuntimeParams, signature?: S): Promise<string>;
|
|
285
287
|
resolveModuleUriSync<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, signature: S, runtimeEnvironment: R, runtimeParams?: RuntimeParams): string;
|
|
288
|
+
getConfig(): ModuleRegistryConfig;
|
|
286
289
|
getPublicApi(): PublicModuleRegistry;
|
|
287
290
|
}
|
|
288
|
-
export type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
|
|
291
|
+
export type PublicModuleRegistry = Pick<ModuleRegistry, 'getConfig' | 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
|
|
289
292
|
export interface BundleProvider {
|
|
290
293
|
name: string;
|
|
291
294
|
bundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams: RuntimeParams, configOverrides?: BundleConfig): Promise<BundleDefinition | undefined>;
|
|
@@ -295,9 +298,10 @@ export interface ModuleBundler {
|
|
|
295
298
|
addBundleTransformers(transformers: UriTransformPlugin[]): void;
|
|
296
299
|
getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfigOverrides): Promise<BundleDefinition>;
|
|
297
300
|
resolveModuleUri(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): Promise<string>;
|
|
301
|
+
getConfig(): BundleConfig;
|
|
298
302
|
getPublicApi(): PublicModuleBundler;
|
|
299
303
|
}
|
|
300
|
-
export type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
304
|
+
export type PublicModuleBundler = Pick<ModuleBundler, 'getConfig' | 'getModuleBundle' | 'resolveModuleUri'>;
|
|
301
305
|
export interface BundleRecord {
|
|
302
306
|
imports?: BaseModuleReference[];
|
|
303
307
|
dynamicImports?: BaseDynamicModuleReference[];
|
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;
|
package/build/views.d.ts
CHANGED
|
@@ -126,6 +126,9 @@ export interface ViewProvider {
|
|
|
126
126
|
getView(viewId: ViewIdentity): Promise<CompiledView | undefined>;
|
|
127
127
|
}
|
|
128
128
|
export interface ViewTransformPluginContext {
|
|
129
|
+
config: {
|
|
130
|
+
cacheDir: string;
|
|
131
|
+
};
|
|
129
132
|
view: View;
|
|
130
133
|
viewParams: ViewParams;
|
|
131
134
|
runtimeEnvironment: RuntimeEnvironment;
|
|
@@ -203,6 +206,12 @@ export interface SsrRequestContext {
|
|
|
203
206
|
locale: string;
|
|
204
207
|
basePath: string;
|
|
205
208
|
}
|
|
209
|
+
export interface SsrRequestOptions {
|
|
210
|
+
bundleSpecifier: string;
|
|
211
|
+
cacheDir: string;
|
|
212
|
+
host?: string;
|
|
213
|
+
requestDepth?: number;
|
|
214
|
+
}
|
|
206
215
|
export interface SsrDataResponse {
|
|
207
216
|
props?: {
|
|
208
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.
|
|
11
|
+
"version": "0.13.0-alpha.0",
|
|
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": "c5fe8db55c74513dbb0937d1b4568109715a13fb"
|
|
33
33
|
}
|