@lwrjs/types 0.10.0-alpha.12 → 0.10.0-alpha.13
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 +13 -10
- package/build/index.d.ts +51 -53
- package/build/server.d.ts +5 -6
- package/build/serviceAPI/appMetadata/appMetadata.d.ts +1 -1
- package/build/serviceAPI/handleStaleModule/handleStaleModule.d.ts +2 -2
- package/build/serviceAPI/loaderPlugins/loaderPlugins.d.ts +8 -8
- package/build/views.d.ts +13 -15
- package/package.json +2 -2
package/build/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, ServiceCtor, Specifier, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
|
|
1
|
+
import type { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, ServiceCtor, Specifier, UriTransformPlugin, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
|
|
2
2
|
export interface View {
|
|
3
3
|
id: string;
|
|
4
4
|
rootComponent?: string;
|
|
@@ -37,7 +37,7 @@ export interface NormalizedLwrAppBootstrapConfig {
|
|
|
37
37
|
module: string | undefined;
|
|
38
38
|
preloadModules: string[];
|
|
39
39
|
}
|
|
40
|
-
export type LwrAppBootstrapConfig = Partial<NormalizedLwrAppBootstrapConfig>;
|
|
40
|
+
export declare type LwrAppBootstrapConfig = Partial<NormalizedLwrAppBootstrapConfig>;
|
|
41
41
|
export interface LwrLockerConfig {
|
|
42
42
|
enabled: boolean;
|
|
43
43
|
trustedComponents?: string[];
|
|
@@ -49,14 +49,14 @@ export interface RouteHandlersConfig {
|
|
|
49
49
|
export interface LocalizedViewRequest extends ViewRequest {
|
|
50
50
|
locale?: string;
|
|
51
51
|
}
|
|
52
|
-
export type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext) => Promise<RouteHandlerViewResponse>;
|
|
52
|
+
export declare type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext) => Promise<RouteHandlerViewResponse>;
|
|
53
53
|
export interface ResourcePaths {
|
|
54
54
|
rootDir: string;
|
|
55
55
|
assets: AssetConfig[];
|
|
56
56
|
layoutsDir: string;
|
|
57
57
|
contentDir: string;
|
|
58
58
|
}
|
|
59
|
-
export type RouteHandlerView = Pick<View, 'contentTemplate' | 'layoutTemplate' | 'rootComponent'>;
|
|
59
|
+
export declare type RouteHandlerView = Pick<View, 'contentTemplate' | 'layoutTemplate' | 'rootComponent'>;
|
|
60
60
|
export interface RouteHandlerViewApi {
|
|
61
61
|
hasViewResponse(view: RouteHandlerView, viewParams?: ViewParams, renderOptions?: RenderOptions): boolean;
|
|
62
62
|
getViewResponse(view: RouteHandlerView, viewParams?: ViewParams, renderOptions?: RenderOptions): Promise<ViewResponse | undefined>;
|
|
@@ -100,6 +100,7 @@ export interface LwrGlobalConfig {
|
|
|
100
100
|
serverType?: ServerTypes;
|
|
101
101
|
staticSiteGenerator?: StaticSiteGenerator;
|
|
102
102
|
locker?: LwrLockerConfig;
|
|
103
|
+
uriTransformers?: ServiceConfig[];
|
|
103
104
|
}
|
|
104
105
|
export interface BuildOptions {
|
|
105
106
|
target?: string;
|
|
@@ -126,6 +127,7 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
|
|
|
126
127
|
resourceProviders: ServiceEntry[];
|
|
127
128
|
assetProviders: ServiceEntry[];
|
|
128
129
|
assetTransformers: ServiceEntry[];
|
|
130
|
+
uriTransformers: ServiceEntry[];
|
|
129
131
|
lwc: NormalizedLwcConfig;
|
|
130
132
|
}
|
|
131
133
|
export interface StaticSiteGenerator {
|
|
@@ -153,6 +155,7 @@ export interface Services {
|
|
|
153
155
|
resourceProviders: ResolvedServiceEntry<ResourceProvider>[];
|
|
154
156
|
assetProviders: ResolvedServiceEntry<AssetProvider>[];
|
|
155
157
|
assetTransformers: ResolvedServiceEntry<AssetTransformPlugin>[];
|
|
158
|
+
uriTransformers: ResolvedServiceEntry<UriTransformPlugin>[];
|
|
156
159
|
}
|
|
157
160
|
export interface RouteHandlers {
|
|
158
161
|
[id: string]: RouteHandlerFunction;
|
|
@@ -167,19 +170,19 @@ export interface AssetDirConfig extends AssetConfigCommon {
|
|
|
167
170
|
export interface AssetFileConfig extends AssetConfigCommon {
|
|
168
171
|
file: string;
|
|
169
172
|
}
|
|
170
|
-
export type AssetConfig = AssetDirConfig | AssetFileConfig;
|
|
173
|
+
export declare type AssetConfig = AssetDirConfig | AssetFileConfig;
|
|
171
174
|
export interface LwcConfig {
|
|
172
175
|
modules: ResolverModuleRecord[];
|
|
173
176
|
interchangeable?: string[];
|
|
174
177
|
interchangeableModules?: InterchangeableModuleRecord[];
|
|
175
178
|
}
|
|
176
|
-
export type InterchangeableModuleMap = Map<Specifier, Map<Environment, Specifier>>;
|
|
179
|
+
export declare type InterchangeableModuleMap = Map<Specifier, Map<Environment, Specifier>>;
|
|
177
180
|
export interface NormalizedLwcConfig extends Omit<LwcConfig, 'interchangeableModules'> {
|
|
178
181
|
interchangeableModulesMap?: InterchangeableModuleMap;
|
|
179
182
|
}
|
|
180
|
-
export type ServiceEntry = [string, any?];
|
|
181
|
-
export type ServiceConfig = string | ServiceEntry;
|
|
182
|
-
export type ResolvedServiceEntry<T extends LwrService> = [ServiceCtor<T>, any?];
|
|
183
|
+
export declare type ServiceEntry = [string, any?];
|
|
184
|
+
export declare type ServiceConfig = string | ServiceEntry;
|
|
185
|
+
export declare type ResolvedServiceEntry<T extends LwrService> = [ServiceCtor<T>, any?];
|
|
183
186
|
export interface BundleConfig {
|
|
184
187
|
exclude?: string[];
|
|
185
188
|
UNSAFE_lwrDefaultExclude?: string[];
|
|
@@ -189,7 +192,7 @@ export interface BundleConfig {
|
|
|
189
192
|
export interface BundleConfigOverrides extends BundleConfig {
|
|
190
193
|
appendExcludes?: boolean;
|
|
191
194
|
}
|
|
192
|
-
export type Environment = string;
|
|
195
|
+
export declare type Environment = string;
|
|
193
196
|
export interface EnvironmentConfig {
|
|
194
197
|
default?: Environment;
|
|
195
198
|
supported?: Environment[];
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
/// <reference types="node" />
|
|
5
2
|
import type { WatchOptions } from 'chokidar';
|
|
6
3
|
import { EventEmitter } from 'events';
|
|
7
4
|
import fs from 'fs';
|
|
@@ -16,16 +13,16 @@ export * from './serviceAPI/serviceAPI.js';
|
|
|
16
13
|
export * from './serviceAPI/loaderPlugins/loaderPlugins.js';
|
|
17
14
|
export * from './serviceAPI/handleStaleModule/handleStaleModule.js';
|
|
18
15
|
export * from './serviceAPI/appMetadata/appMetadata.js';
|
|
19
|
-
export type Json = undefined | null | boolean | number | string | Json[] | {
|
|
16
|
+
export declare type Json = undefined | null | boolean | number | string | Json[] | {
|
|
20
17
|
[prop: string]: Json;
|
|
21
18
|
};
|
|
22
|
-
export type Dict<T> = Record<string, T>;
|
|
23
|
-
export type JsonCompatible<T> = {
|
|
19
|
+
export declare type Dict<T> = Record<string, T>;
|
|
20
|
+
export declare type JsonCompatible<T> = {
|
|
24
21
|
[P in keyof T]: T[P] extends Json ? T[P] : Pick<T, P> extends Required<Pick<T, P>> ? never : JsonCompatible<T[P]>;
|
|
25
22
|
};
|
|
26
|
-
export type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
27
|
-
export type Specifier = string;
|
|
28
|
-
export type Version = string;
|
|
23
|
+
export declare type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
24
|
+
export declare type Specifier = string;
|
|
25
|
+
export declare type Version = string;
|
|
29
26
|
export interface AbstractModuleId {
|
|
30
27
|
specifier: string;
|
|
31
28
|
namespace?: string;
|
|
@@ -68,7 +65,7 @@ export interface ImportMetadataImports {
|
|
|
68
65
|
export interface ImportMetadataIndex {
|
|
69
66
|
[specifier: string]: string;
|
|
70
67
|
}
|
|
71
|
-
export type ModuleEntry = FsModuleEntry | VirtualModuleEntry;
|
|
68
|
+
export declare type ModuleEntry = FsModuleEntry | VirtualModuleEntry;
|
|
72
69
|
interface BaseModuleEntry {
|
|
73
70
|
id: string;
|
|
74
71
|
entry: string;
|
|
@@ -147,8 +144,8 @@ export interface CodeSource {
|
|
|
147
144
|
export interface SignedSource extends CodeSource {
|
|
148
145
|
signedCode?: string;
|
|
149
146
|
}
|
|
150
|
-
export type CompatMode = '0' | '1';
|
|
151
|
-
export type ModuleFormat = 'esm' | 'amd';
|
|
147
|
+
export declare type CompatMode = '0' | '1';
|
|
148
|
+
export declare type ModuleFormat = 'esm' | 'amd';
|
|
152
149
|
export interface ServerModeConfig {
|
|
153
150
|
format: ModuleFormat;
|
|
154
151
|
bundle: boolean;
|
|
@@ -180,7 +177,7 @@ export interface RuntimeEnvironment extends ServerModeConfig {
|
|
|
180
177
|
export interface SourceMapRuntimeEnvironment extends RuntimeEnvironment {
|
|
181
178
|
sourceMapUrl?: string;
|
|
182
179
|
}
|
|
183
|
-
export type RuntimeParams = Record<string, string | number | boolean | null | undefined | Record<string, string>>;
|
|
180
|
+
export declare type RuntimeParams = Record<string, string | number | boolean | null | undefined | Record<string, string>>;
|
|
184
181
|
export interface ModuleIdentity {
|
|
185
182
|
signature: string;
|
|
186
183
|
moduleId: AbstractModuleId;
|
|
@@ -236,14 +233,14 @@ export interface LwrAppEmitter {
|
|
|
236
233
|
notifyViewSourceChanged(payload: CompiledView): void;
|
|
237
234
|
notifyAssetSourceChanged(payload: AssetSource): void;
|
|
238
235
|
}
|
|
239
|
-
export type EVENT_MODULE_DEFINITION_CHANGED = 'module_definition_changed';
|
|
236
|
+
export declare type EVENT_MODULE_DEFINITION_CHANGED = 'module_definition_changed';
|
|
240
237
|
export interface ModuleDefinitionChangedEvent {
|
|
241
238
|
eventType: EVENT_MODULE_DEFINITION_CHANGED;
|
|
242
239
|
payload: LinkedModuleDefinition;
|
|
243
240
|
}
|
|
244
|
-
export type EVENT_MODULE_SOURCE_CHANGED = 'module_source_changed';
|
|
245
|
-
export type EVENT_ASSET_SOURCE_CHANGED = 'asset_source_changed';
|
|
246
|
-
export type EVENT_VIEW_SOURCE_CHANGED = 'view_source_changed';
|
|
241
|
+
export declare type EVENT_MODULE_SOURCE_CHANGED = 'module_source_changed';
|
|
242
|
+
export declare type EVENT_ASSET_SOURCE_CHANGED = 'asset_source_changed';
|
|
243
|
+
export declare type EVENT_VIEW_SOURCE_CHANGED = 'view_source_changed';
|
|
247
244
|
export interface ModuleSourceChangedEvent {
|
|
248
245
|
eventType: EVENT_MODULE_SOURCE_CHANGED;
|
|
249
246
|
payload: ModuleCompiled;
|
|
@@ -261,7 +258,7 @@ export interface ModuleProvider {
|
|
|
261
258
|
getModule<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleCompiled | undefined>;
|
|
262
259
|
getModuleEntry<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleEntry | undefined>;
|
|
263
260
|
}
|
|
264
|
-
export type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
|
|
261
|
+
export declare type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
|
|
265
262
|
export interface ServiceCtor<T extends LwrService, R extends Record<string, Json> = {}> {
|
|
266
263
|
new (providerConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
|
|
267
264
|
}
|
|
@@ -275,18 +272,19 @@ export interface ModuleRegistry {
|
|
|
275
272
|
resolveModuleUriSync<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, signature: S, runtimeEnvironment: R, runtimeParams?: RuntimeParams): string;
|
|
276
273
|
getPublicApi(): PublicModuleRegistry;
|
|
277
274
|
}
|
|
278
|
-
export type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
|
|
275
|
+
export declare type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
|
|
279
276
|
export interface BundleProvider {
|
|
280
277
|
name: string;
|
|
281
278
|
bundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams: RuntimeParams, configOverrides?: BundleConfig): Promise<BundleDefinition | undefined>;
|
|
282
279
|
}
|
|
283
280
|
export interface ModuleBundler {
|
|
284
281
|
addBundleProviders(providers: BundleProvider[]): void;
|
|
282
|
+
addBundleTransformers(transformers: UriTransformPlugin[]): void;
|
|
285
283
|
getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfigOverrides): Promise<BundleDefinition>;
|
|
286
284
|
resolveModuleUri(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): Promise<string>;
|
|
287
285
|
getPublicApi(): PublicModuleBundler;
|
|
288
286
|
}
|
|
289
|
-
export type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
287
|
+
export declare type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
290
288
|
export interface BundleRecord {
|
|
291
289
|
imports?: BaseModuleReference[];
|
|
292
290
|
dynamicImports?: BaseDynamicModuleReference[];
|
|
@@ -337,13 +335,14 @@ export interface AssetIdentifier {
|
|
|
337
335
|
type?: AssetType;
|
|
338
336
|
importer?: string;
|
|
339
337
|
}
|
|
340
|
-
export interface
|
|
338
|
+
export interface UriDefinition {
|
|
341
339
|
uri: string;
|
|
342
340
|
immutable: boolean;
|
|
341
|
+
artifactType: ArtifactType;
|
|
343
342
|
entry: string;
|
|
344
343
|
external?: boolean;
|
|
345
344
|
}
|
|
346
|
-
export type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module' | string;
|
|
345
|
+
export declare type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module' | string;
|
|
347
346
|
export interface ResourceDefinition {
|
|
348
347
|
specifier?: string;
|
|
349
348
|
type: ResourceType;
|
|
@@ -370,13 +369,13 @@ export interface AssetSource {
|
|
|
370
369
|
type?: AssetType;
|
|
371
370
|
noTransform?: boolean;
|
|
372
371
|
}
|
|
373
|
-
export type AssetType = 'asset' | 'content-asset' | 'external' | 'unknown';
|
|
372
|
+
export declare type AssetType = 'asset' | 'content-asset' | 'external' | 'unknown';
|
|
374
373
|
export interface AssetDefinition extends AssetSource {
|
|
375
374
|
uri: string;
|
|
376
375
|
type: AssetType;
|
|
377
376
|
stream: (encoding?: BufferEncoding) => Readable;
|
|
378
377
|
}
|
|
379
|
-
export type ResourceJson = Pick<ResourceDefinition, 'type' | 'src'>;
|
|
378
|
+
export declare type ResourceJson = Pick<ResourceDefinition, 'type' | 'src'>;
|
|
380
379
|
export interface ResourceProvider {
|
|
381
380
|
name: string;
|
|
382
381
|
getResource<R extends ResourceIdentifier, T extends BootstrapRuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T, runtimeParams?: RuntimeParams): Promise<ResourceDefinition | undefined>;
|
|
@@ -385,27 +384,25 @@ export interface AssetProvider {
|
|
|
385
384
|
name: string;
|
|
386
385
|
getAsset(assetIdentifier: AssetIdentifier): Promise<AssetSource | undefined>;
|
|
387
386
|
}
|
|
388
|
-
export type
|
|
389
|
-
type
|
|
390
|
-
type
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
};
|
|
394
|
-
type AssetPluginExtractMetaHook = (code: string | Buffer, assetSource: AssetSource, context?: TransformPluginContext) => Promise<AssetPluginExtractMetaHookReturn>;
|
|
395
|
-
type AssetPluginExtractMetaHookReturn = null | undefined | false | {
|
|
387
|
+
export declare type ArtifactType = 'asset' | 'bundle' | 'resource';
|
|
388
|
+
export declare type ArtifactDefinition = AssetDefinition | BundleDefinition | ResourceDefinition;
|
|
389
|
+
export declare type AssetTransformSourceHook = (assetSource: AssetSource, runtimeEnvironment: RuntimeEnvironment) => Promise<AssetTransformSourceHookReturn>;
|
|
390
|
+
export declare type AssetTransformSourceHookReturn = undefined | {
|
|
391
|
+
source: string | Buffer;
|
|
396
392
|
metadata?: AssetMetadata;
|
|
397
|
-
context?: TransformPluginContext;
|
|
398
|
-
};
|
|
399
|
-
type AssetPluginOptimizeHook = (code: string | Buffer, assetSource: AssetSource, context?: TransformPluginContext) => Promise<AssetPluginOptimizeHookReturn>;
|
|
400
|
-
type AssetPluginOptimizeHookReturn = null | undefined | false | string | Buffer | {
|
|
401
|
-
code: string | Buffer;
|
|
402
|
-
map?: any;
|
|
403
|
-
context?: TransformPluginContext;
|
|
404
393
|
};
|
|
394
|
+
export declare type UriTransformHook = (uri: UriDefinition, artifactDef?: ArtifactDefinition, runtimeEnvironment?: RuntimeEnvironment) => Promise<UriTransformHookReturn>;
|
|
395
|
+
export declare type UriTransformHookReturn = undefined | UriDefinition;
|
|
396
|
+
export interface UriTransformHooks {
|
|
397
|
+
transformUri: UriTransformHook;
|
|
398
|
+
}
|
|
399
|
+
export interface UriTransformPlugin extends UriTransformHooks {
|
|
400
|
+
name: string;
|
|
401
|
+
}
|
|
402
|
+
export declare type AssetUriTransformHook = (uri: UriDefinition, assetDef: AssetDefinition, runtimeEnvironment: RuntimeEnvironment) => Promise<UriTransformHookReturn>;
|
|
405
403
|
export interface AssetTransformHooks {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
optimize: AssetPluginOptimizeHook;
|
|
404
|
+
transformUri: AssetUriTransformHook;
|
|
405
|
+
transformSource: AssetTransformSourceHook;
|
|
409
406
|
}
|
|
410
407
|
export interface AssetTransformPlugin extends Partial<AssetTransformHooks> {
|
|
411
408
|
name: string;
|
|
@@ -413,27 +410,28 @@ export interface AssetTransformPlugin extends Partial<AssetTransformHooks> {
|
|
|
413
410
|
export interface ResourceRegistry {
|
|
414
411
|
name: string;
|
|
415
412
|
addResourceProviders(provider: ResourceProvider[]): void;
|
|
413
|
+
addResourceTransformers(provider: UriTransformPlugin[]): void;
|
|
416
414
|
getResource<R extends ResourceIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T, runtimeParams?: RuntimeParams): Promise<ResourceDefinition | undefined>;
|
|
417
|
-
resolveResourceUri<R extends ResourceIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): string
|
|
415
|
+
resolveResourceUri<R extends ResourceIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<string>;
|
|
418
416
|
getPublicApi(): PublicResourceRegistry;
|
|
419
417
|
}
|
|
420
|
-
export type PublicResourceRegistry = Pick<ResourceRegistry, 'getResource' | 'resolveResourceUri'>;
|
|
418
|
+
export declare type PublicResourceRegistry = Pick<ResourceRegistry, 'getResource' | 'resolveResourceUri'>;
|
|
421
419
|
export interface AssetRegistry {
|
|
422
420
|
name: string;
|
|
423
421
|
addAssetProviders(provider: AssetProvider[]): void;
|
|
424
|
-
addAssetTransformers(transformers: AssetTransformPlugin[]): void;
|
|
422
|
+
addAssetTransformers(transformers: (AssetTransformPlugin | UriTransformPlugin)[]): void;
|
|
425
423
|
getAsset<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T, includeMetadata?: boolean): Promise<AssetDefinition>;
|
|
426
|
-
resolveAssetUri<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<
|
|
424
|
+
resolveAssetUri<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<UriDefinition>;
|
|
427
425
|
getPublicApi(): PublicAssetRegistry;
|
|
428
426
|
}
|
|
429
|
-
export type PublicAssetRegistry = Pick<AssetRegistry, 'getAsset' | 'resolveAssetUri'>;
|
|
427
|
+
export declare type PublicAssetRegistry = Pick<AssetRegistry, 'getAsset' | 'resolveAssetUri'>;
|
|
430
428
|
export interface LwcCompilerConfig {
|
|
431
429
|
name: string;
|
|
432
430
|
namespace?: string;
|
|
433
431
|
filename: string;
|
|
434
432
|
scopedStyles?: boolean;
|
|
435
433
|
}
|
|
436
|
-
export type SourceMap = string | null | undefined;
|
|
434
|
+
export declare type SourceMap = string | null | undefined;
|
|
437
435
|
export interface CompiledMetadata {
|
|
438
436
|
imports?: Import[];
|
|
439
437
|
dynamicImports?: DynamicImport[];
|
|
@@ -446,7 +444,7 @@ export interface Import {
|
|
|
446
444
|
moduleSpecifier: string;
|
|
447
445
|
location: SourceLocation;
|
|
448
446
|
}
|
|
449
|
-
export type ModuleNameType = 'string' | 'unresolved';
|
|
447
|
+
export declare type ModuleNameType = 'string' | 'unresolved';
|
|
450
448
|
export interface DynamicImport {
|
|
451
449
|
moduleSpecifier: string;
|
|
452
450
|
location: SourceLocation;
|
|
@@ -541,7 +539,7 @@ export interface GraphDepthOptions {
|
|
|
541
539
|
dynamic: number;
|
|
542
540
|
includeId?: IncludeIdHook;
|
|
543
541
|
}
|
|
544
|
-
export type GraphDepth = 'all' | 'direct' | 'none';
|
|
542
|
+
export declare type GraphDepth = 'all' | 'direct' | 'none';
|
|
545
543
|
export interface FlatGraphNode {
|
|
546
544
|
specifier: Specifier;
|
|
547
545
|
static: Specifier[];
|
|
@@ -551,14 +549,14 @@ export interface GraphNode {
|
|
|
551
549
|
static: Specifier[];
|
|
552
550
|
dynamic: Specifier[];
|
|
553
551
|
}
|
|
554
|
-
export type URIMap = Record<string, string>;
|
|
555
|
-
export type LinkedModuleDefinitionMap = Record<string, LinkedModuleDefinition | BundleDefinition>;
|
|
552
|
+
export declare type URIMap = Record<string, string>;
|
|
553
|
+
export declare type LinkedModuleDefinitionMap = Record<string, LinkedModuleDefinition | BundleDefinition>;
|
|
556
554
|
export interface FlattenedModuleGraphs {
|
|
557
555
|
graphs: FlatGraphNode[];
|
|
558
556
|
uriMap: URIMap;
|
|
559
557
|
linkedDefinitions: LinkedModuleDefinitionMap;
|
|
560
558
|
}
|
|
561
|
-
export type ImportMapImports = {
|
|
559
|
+
export declare type ImportMapImports = {
|
|
562
560
|
[key: string]: string;
|
|
563
561
|
};
|
|
564
562
|
export interface LwrBuilderOverwriteOptions {
|
package/build/server.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { Application as ExpressApp } from 'express';
|
|
4
3
|
import Koa, { Context } from 'koa';
|
|
5
4
|
import http from 'http';
|
|
6
5
|
import { Readable } from 'stream';
|
|
7
6
|
import type { NormalizedLwrGlobalConfig, RuntimeContext, RuntimeEnvironment } from './index.js';
|
|
8
|
-
export type ServerTypes = 'koa' | 'express' | 'fs';
|
|
9
|
-
export type ServerTypeImpl<T extends ServerTypes> = T extends 'koa' ? Koa : T extends 'express' ? ExpressApp : T extends 'fs' ? LwrDispatcher : never;
|
|
7
|
+
export declare type ServerTypes = 'koa' | 'express' | 'fs';
|
|
8
|
+
export declare type ServerTypeImpl<T extends ServerTypes> = T extends 'koa' ? Koa : T extends 'express' ? ExpressApp : T extends 'fs' ? LwrDispatcher : never;
|
|
10
9
|
export interface FsContext extends Context {
|
|
11
10
|
fs?: {
|
|
12
11
|
headers?: http.IncomingHttpHeaders;
|
|
@@ -35,8 +34,8 @@ export interface InternalAppServer<T extends ServerTypes> {
|
|
|
35
34
|
useCompression(): void;
|
|
36
35
|
getRegexWildcard(): string;
|
|
37
36
|
}
|
|
38
|
-
export type PublicAppServer<T extends ServerTypes> = Pick<InternalAppServer<T>, 'use' | 'all' | 'get' | 'post' | 'getRegexWildcard'>;
|
|
39
|
-
export type InternalAppServerOptions = {
|
|
37
|
+
export declare type PublicAppServer<T extends ServerTypes> = Pick<InternalAppServer<T>, 'use' | 'all' | 'get' | 'post' | 'getRegexWildcard'>;
|
|
38
|
+
export declare type InternalAppServerOptions = {
|
|
40
39
|
app?: ServerTypeImpl<ServerTypes>;
|
|
41
40
|
basePath?: string;
|
|
42
41
|
};
|
|
@@ -46,7 +45,7 @@ export interface InternalAppServerConstructable {
|
|
|
46
45
|
export interface MiddlewareFunction {
|
|
47
46
|
(req: MiddlewareRequest, res: MiddlewareResponse, next: Function): void;
|
|
48
47
|
}
|
|
49
|
-
export type Headers = http.IncomingHttpHeaders;
|
|
48
|
+
export declare type Headers = http.IncomingHttpHeaders;
|
|
50
49
|
export interface MiddlewareRequest {
|
|
51
50
|
params: any;
|
|
52
51
|
originalUrl: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export interface RegisterHandleStaleModuleHook {
|
|
2
2
|
(hook: HandleStaleModuleHook): void;
|
|
3
3
|
}
|
|
4
|
-
export type HandleStaleModuleHookArgs = {
|
|
4
|
+
export declare type HandleStaleModuleHookArgs = {
|
|
5
5
|
name: string;
|
|
6
6
|
oldUrl: string;
|
|
7
7
|
newUrl: string;
|
|
8
8
|
};
|
|
9
|
-
export type DEPRECIATEDHandleStaleModuleHookArgs = {
|
|
9
|
+
export declare type DEPRECIATEDHandleStaleModuleHookArgs = {
|
|
10
10
|
name: string;
|
|
11
11
|
oldHash: string;
|
|
12
12
|
newHash: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ImportMetadata } from '../..';
|
|
2
|
-
type ResolveParams = {
|
|
2
|
+
declare type ResolveParams = {
|
|
3
3
|
parentUrl: string;
|
|
4
4
|
};
|
|
5
5
|
export interface RegisterLoaderHooks {
|
|
6
6
|
(hook: LoaderHooks): void;
|
|
7
7
|
}
|
|
8
|
-
export type LoaderHooks = {
|
|
8
|
+
export declare type LoaderHooks = {
|
|
9
9
|
resolveModule?: ResolveModuleHook;
|
|
10
10
|
loadModule?: LoadModuleHook;
|
|
11
11
|
loadMapping?: LoadMappingHook;
|
|
@@ -19,19 +19,19 @@ export interface LoadModuleHook {
|
|
|
19
19
|
export interface LoadMappingHook {
|
|
20
20
|
(specifier: string, params: MappingResolveParams): Promise<MappingResponse> | MappingResponse;
|
|
21
21
|
}
|
|
22
|
-
export type MappingResolveParams = {
|
|
22
|
+
export declare type MappingResolveParams = {
|
|
23
23
|
knownModules: string[];
|
|
24
24
|
};
|
|
25
|
-
export type MappingResponse = ImportMetadata | null;
|
|
26
|
-
export type URLResponse = {
|
|
25
|
+
export declare type MappingResponse = ImportMetadata | null;
|
|
26
|
+
export declare type URLResponse = {
|
|
27
27
|
url: string;
|
|
28
28
|
};
|
|
29
|
-
export type CustomResponse = {
|
|
29
|
+
export declare type CustomResponse = {
|
|
30
30
|
data: string;
|
|
31
31
|
status: number;
|
|
32
32
|
statusText?: string;
|
|
33
33
|
};
|
|
34
|
-
export type LoadHookResponse = CustomResponse | globalThis.Response | null;
|
|
35
|
-
export type ResolveHookResponse = URLResponse | string | null;
|
|
34
|
+
export declare type LoadHookResponse = CustomResponse | globalThis.Response | null;
|
|
35
|
+
export declare type ResolveHookResponse = URLResponse | string | null;
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=loaderPlugins.d.ts.map
|
package/build/views.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { LwrErrorRoute, LwrRoute, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
|
|
3
|
-
import { AssetSource,
|
|
4
|
-
export type ViewIdentity = Pick<View, 'rootComponent' | 'contentTemplate'>;
|
|
3
|
+
import { AssetSource, UriDefinition, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier } from './index.js';
|
|
4
|
+
export declare type ViewIdentity = Pick<View, 'rootComponent' | 'contentTemplate'>;
|
|
5
5
|
export interface ViewSource {
|
|
6
6
|
name: string;
|
|
7
7
|
slug: string;
|
|
@@ -18,7 +18,7 @@ export interface CompiledView extends ViewSource {
|
|
|
18
18
|
};
|
|
19
19
|
render: (context?: any) => Promise<RenderingResult>;
|
|
20
20
|
}
|
|
21
|
-
export type NormalizedRenderingResult = Required<RenderingResult>;
|
|
21
|
+
export declare type NormalizedRenderingResult = Required<RenderingResult>;
|
|
22
22
|
export interface RenderingResult {
|
|
23
23
|
renderedView: string;
|
|
24
24
|
metadata?: RenderedViewMetadata;
|
|
@@ -48,7 +48,7 @@ export interface RenderedViewMetadata {
|
|
|
48
48
|
export interface RenderedAssetReference {
|
|
49
49
|
url: string;
|
|
50
50
|
tagName?: string;
|
|
51
|
-
override?:
|
|
51
|
+
override?: UriDefinition;
|
|
52
52
|
}
|
|
53
53
|
export interface AssetReference extends RenderedAssetReference {
|
|
54
54
|
importer?: string;
|
|
@@ -107,7 +107,7 @@ export interface ViewResponse {
|
|
|
107
107
|
viewDefinition?: LinkedViewDefinition;
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
export type RouteHandlerViewResponse = ViewDefinitionResponse | ViewResponse;
|
|
110
|
+
export declare type RouteHandlerViewResponse = ViewDefinitionResponse | ViewResponse;
|
|
111
111
|
export interface ViewDefinitionResponse {
|
|
112
112
|
status?: number;
|
|
113
113
|
view: RouteHandlerView;
|
|
@@ -122,7 +122,7 @@ export interface ViewProvider {
|
|
|
122
122
|
initialize(): Promise<void>;
|
|
123
123
|
getView(viewId: ViewIdentity): Promise<CompiledView | undefined>;
|
|
124
124
|
}
|
|
125
|
-
export interface
|
|
125
|
+
export interface ViewTransformPluginContext {
|
|
126
126
|
view: View;
|
|
127
127
|
viewParams: ViewParams;
|
|
128
128
|
runtimeEnvironment: RuntimeEnvironment;
|
|
@@ -133,17 +133,15 @@ export interface ViewTranformPluginContext {
|
|
|
133
133
|
};
|
|
134
134
|
importer?: string;
|
|
135
135
|
}
|
|
136
|
-
type ViewPluginLinkHook = (builder: LwrStringBuilder, viewContext:
|
|
137
|
-
type ViewPluginLinkHookReturn = void | null | undefined | false | LwrStringBuilder | {
|
|
136
|
+
declare type ViewPluginLinkHook = (builder: LwrStringBuilder, viewContext: ViewTransformPluginContext, viewMetadata: RenderedViewMetadata) => Promise<ViewPluginLinkHookReturn>;
|
|
137
|
+
declare type ViewPluginLinkHookReturn = void | null | undefined | false | LwrStringBuilder | {
|
|
138
138
|
builder?: LwrStringBuilder;
|
|
139
|
-
context?: TransformPluginContext;
|
|
140
139
|
cache?: CacheResponse;
|
|
141
140
|
};
|
|
142
|
-
type ViewPluginOptimizeHook = (code: string, assetSource: AssetSource
|
|
143
|
-
type ViewPluginOptimizeHookReturn = null | undefined | false | string | {
|
|
141
|
+
declare type ViewPluginOptimizeHook = (code: string, assetSource: AssetSource) => Promise<ViewPluginOptimizeHookReturn>;
|
|
142
|
+
declare type ViewPluginOptimizeHookReturn = null | undefined | false | string | {
|
|
144
143
|
code: string;
|
|
145
144
|
map?: any;
|
|
146
|
-
context?: TransformPluginContext;
|
|
147
145
|
};
|
|
148
146
|
export interface ViewTransformHooks {
|
|
149
147
|
link: ViewPluginLinkHook;
|
|
@@ -152,7 +150,7 @@ export interface ViewTransformHooks {
|
|
|
152
150
|
export interface ViewTransformPlugin extends Partial<ViewTransformHooks> {
|
|
153
151
|
name: string;
|
|
154
152
|
}
|
|
155
|
-
export type ViewParams = Record<string, Json>;
|
|
153
|
+
export declare type ViewParams = Record<string, Json>;
|
|
156
154
|
export interface ViewInfo {
|
|
157
155
|
id: string;
|
|
158
156
|
url: string;
|
|
@@ -169,7 +167,7 @@ export interface ViewPageContext {
|
|
|
169
167
|
title?: string;
|
|
170
168
|
url: string;
|
|
171
169
|
}
|
|
172
|
-
export type ViewModuleResourceContext = {
|
|
170
|
+
export declare type ViewModuleResourceContext = {
|
|
173
171
|
isPreload?: boolean;
|
|
174
172
|
isSSR?: boolean;
|
|
175
173
|
async?: boolean;
|
|
@@ -183,7 +181,7 @@ export interface ViewRegistry {
|
|
|
183
181
|
hasViewDefinition<R extends RuntimeEnvironment>(view: View, viewParams: ViewParams, runtimeEnvironment: R, runtimeParams?: RuntimeParams, renderOptions?: RenderOptions): boolean;
|
|
184
182
|
getPublicApi(): PublicViewRegistry;
|
|
185
183
|
}
|
|
186
|
-
export type PublicViewRegistry = Pick<ViewRegistry, 'getView' | 'getViewDefinition'>;
|
|
184
|
+
export declare type PublicViewRegistry = Pick<ViewRegistry, 'getView' | 'getViewDefinition'>;
|
|
187
185
|
export interface ViewHandler {
|
|
188
186
|
getViewContent(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
|
|
189
187
|
getViewJson(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "tsc -b"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
-
"version": "0.10.0-alpha.
|
|
11
|
+
"version": "0.10.0-alpha.13",
|
|
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": ">=16.0.0 <20"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "f6d142d5a027554cb1685389e0b173734149683d"
|
|
33
33
|
}
|