@lwrjs/types 0.10.0-alpha.12 → 0.10.0-alpha.14
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 +15 -10
- package/build/index.d.ts +54 -55
- 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,29 +170,31 @@ 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[];
|
|
186
189
|
external?: Record<string, string>;
|
|
187
190
|
alias?: Record<string, string>;
|
|
191
|
+
groups?: BundleGroups;
|
|
188
192
|
}
|
|
189
193
|
export interface BundleConfigOverrides extends BundleConfig {
|
|
190
194
|
appendExcludes?: boolean;
|
|
191
195
|
}
|
|
192
|
-
export type
|
|
196
|
+
export declare type BundleGroups = Record<string, string[]>;
|
|
197
|
+
export declare type Environment = string;
|
|
193
198
|
export interface EnvironmentConfig {
|
|
194
199
|
default?: Environment;
|
|
195
200
|
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;
|
|
@@ -165,10 +162,11 @@ export interface ServerModeConfig {
|
|
|
165
162
|
featureFlags: FeatureFlags;
|
|
166
163
|
}
|
|
167
164
|
export interface FeatureFlags extends Record<string, boolean | undefined> {
|
|
165
|
+
ASSETS_ON_LAMBDA?: boolean;
|
|
168
166
|
LEGACY_LOADER?: boolean;
|
|
169
|
-
SSR_STATIC_BUNDLES?: boolean;
|
|
170
167
|
SSR_SANDBOX_WORKER?: boolean;
|
|
171
|
-
|
|
168
|
+
SSR_STATIC_BUNDLES?: boolean;
|
|
169
|
+
UNVERSIONED_ALIASES?: boolean;
|
|
172
170
|
}
|
|
173
171
|
export interface RuntimeEnvironment extends ServerModeConfig {
|
|
174
172
|
apiVersion: string;
|
|
@@ -180,7 +178,7 @@ export interface RuntimeEnvironment extends ServerModeConfig {
|
|
|
180
178
|
export interface SourceMapRuntimeEnvironment extends RuntimeEnvironment {
|
|
181
179
|
sourceMapUrl?: string;
|
|
182
180
|
}
|
|
183
|
-
export type RuntimeParams = Record<string, string | number | boolean | null | undefined | Record<string, string>>;
|
|
181
|
+
export declare type RuntimeParams = Record<string, string | number | boolean | null | undefined | Record<string, string>>;
|
|
184
182
|
export interface ModuleIdentity {
|
|
185
183
|
signature: string;
|
|
186
184
|
moduleId: AbstractModuleId;
|
|
@@ -236,14 +234,14 @@ export interface LwrAppEmitter {
|
|
|
236
234
|
notifyViewSourceChanged(payload: CompiledView): void;
|
|
237
235
|
notifyAssetSourceChanged(payload: AssetSource): void;
|
|
238
236
|
}
|
|
239
|
-
export type EVENT_MODULE_DEFINITION_CHANGED = 'module_definition_changed';
|
|
237
|
+
export declare type EVENT_MODULE_DEFINITION_CHANGED = 'module_definition_changed';
|
|
240
238
|
export interface ModuleDefinitionChangedEvent {
|
|
241
239
|
eventType: EVENT_MODULE_DEFINITION_CHANGED;
|
|
242
240
|
payload: LinkedModuleDefinition;
|
|
243
241
|
}
|
|
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';
|
|
242
|
+
export declare type EVENT_MODULE_SOURCE_CHANGED = 'module_source_changed';
|
|
243
|
+
export declare type EVENT_ASSET_SOURCE_CHANGED = 'asset_source_changed';
|
|
244
|
+
export declare type EVENT_VIEW_SOURCE_CHANGED = 'view_source_changed';
|
|
247
245
|
export interface ModuleSourceChangedEvent {
|
|
248
246
|
eventType: EVENT_MODULE_SOURCE_CHANGED;
|
|
249
247
|
payload: ModuleCompiled;
|
|
@@ -261,7 +259,7 @@ export interface ModuleProvider {
|
|
|
261
259
|
getModule<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleCompiled | undefined>;
|
|
262
260
|
getModuleEntry<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleEntry | undefined>;
|
|
263
261
|
}
|
|
264
|
-
export type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
|
|
262
|
+
export declare type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
|
|
265
263
|
export interface ServiceCtor<T extends LwrService, R extends Record<string, Json> = {}> {
|
|
266
264
|
new (providerConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
|
|
267
265
|
}
|
|
@@ -275,18 +273,19 @@ export interface ModuleRegistry {
|
|
|
275
273
|
resolveModuleUriSync<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, signature: S, runtimeEnvironment: R, runtimeParams?: RuntimeParams): string;
|
|
276
274
|
getPublicApi(): PublicModuleRegistry;
|
|
277
275
|
}
|
|
278
|
-
export type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
|
|
276
|
+
export declare type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
|
|
279
277
|
export interface BundleProvider {
|
|
280
278
|
name: string;
|
|
281
279
|
bundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams: RuntimeParams, configOverrides?: BundleConfig): Promise<BundleDefinition | undefined>;
|
|
282
280
|
}
|
|
283
281
|
export interface ModuleBundler {
|
|
284
282
|
addBundleProviders(providers: BundleProvider[]): void;
|
|
283
|
+
addBundleTransformers(transformers: UriTransformPlugin[]): void;
|
|
285
284
|
getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfigOverrides): Promise<BundleDefinition>;
|
|
286
285
|
resolveModuleUri(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): Promise<string>;
|
|
287
286
|
getPublicApi(): PublicModuleBundler;
|
|
288
287
|
}
|
|
289
|
-
export type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
288
|
+
export declare type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
290
289
|
export interface BundleRecord {
|
|
291
290
|
imports?: BaseModuleReference[];
|
|
292
291
|
dynamicImports?: BaseDynamicModuleReference[];
|
|
@@ -337,13 +336,14 @@ export interface AssetIdentifier {
|
|
|
337
336
|
type?: AssetType;
|
|
338
337
|
importer?: string;
|
|
339
338
|
}
|
|
340
|
-
export interface
|
|
339
|
+
export interface UriDefinition {
|
|
341
340
|
uri: string;
|
|
342
341
|
immutable: boolean;
|
|
342
|
+
artifactType: ArtifactType;
|
|
343
343
|
entry: string;
|
|
344
344
|
external?: boolean;
|
|
345
345
|
}
|
|
346
|
-
export type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module' | string;
|
|
346
|
+
export declare type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module' | string;
|
|
347
347
|
export interface ResourceDefinition {
|
|
348
348
|
specifier?: string;
|
|
349
349
|
type: ResourceType;
|
|
@@ -370,13 +370,13 @@ export interface AssetSource {
|
|
|
370
370
|
type?: AssetType;
|
|
371
371
|
noTransform?: boolean;
|
|
372
372
|
}
|
|
373
|
-
export type AssetType = 'asset' | 'content-asset' | 'external' | 'unknown';
|
|
373
|
+
export declare type AssetType = 'asset' | 'content-asset' | 'external' | 'unknown';
|
|
374
374
|
export interface AssetDefinition extends AssetSource {
|
|
375
375
|
uri: string;
|
|
376
376
|
type: AssetType;
|
|
377
377
|
stream: (encoding?: BufferEncoding) => Readable;
|
|
378
378
|
}
|
|
379
|
-
export type ResourceJson = Pick<ResourceDefinition, 'type' | 'src'>;
|
|
379
|
+
export declare type ResourceJson = Pick<ResourceDefinition, 'type' | 'src'>;
|
|
380
380
|
export interface ResourceProvider {
|
|
381
381
|
name: string;
|
|
382
382
|
getResource<R extends ResourceIdentifier, T extends BootstrapRuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T, runtimeParams?: RuntimeParams): Promise<ResourceDefinition | undefined>;
|
|
@@ -385,27 +385,25 @@ export interface AssetProvider {
|
|
|
385
385
|
name: string;
|
|
386
386
|
getAsset(assetIdentifier: AssetIdentifier): Promise<AssetSource | undefined>;
|
|
387
387
|
}
|
|
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 | {
|
|
388
|
+
export declare type ArtifactType = 'asset' | 'bundle' | 'resource';
|
|
389
|
+
export declare type ArtifactDefinition = AssetDefinition | BundleDefinition | ResourceDefinition;
|
|
390
|
+
export declare type AssetTransformSourceHook = (assetSource: AssetSource, runtimeEnvironment: RuntimeEnvironment) => Promise<AssetTransformSourceHookReturn>;
|
|
391
|
+
export declare type AssetTransformSourceHookReturn = undefined | {
|
|
392
|
+
source: string | Buffer;
|
|
396
393
|
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
394
|
};
|
|
395
|
+
export declare type UriTransformHook = (uri: UriDefinition, artifactDef?: ArtifactDefinition, runtimeEnvironment?: RuntimeEnvironment) => Promise<UriTransformHookReturn>;
|
|
396
|
+
export declare type UriTransformHookReturn = undefined | UriDefinition;
|
|
397
|
+
export interface UriTransformHooks {
|
|
398
|
+
transformUri: UriTransformHook;
|
|
399
|
+
}
|
|
400
|
+
export interface UriTransformPlugin extends UriTransformHooks {
|
|
401
|
+
name: string;
|
|
402
|
+
}
|
|
403
|
+
export declare type AssetUriTransformHook = (uri: UriDefinition, assetDef: AssetDefinition, runtimeEnvironment: RuntimeEnvironment) => Promise<UriTransformHookReturn>;
|
|
405
404
|
export interface AssetTransformHooks {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
optimize: AssetPluginOptimizeHook;
|
|
405
|
+
transformUri: AssetUriTransformHook;
|
|
406
|
+
transformSource: AssetTransformSourceHook;
|
|
409
407
|
}
|
|
410
408
|
export interface AssetTransformPlugin extends Partial<AssetTransformHooks> {
|
|
411
409
|
name: string;
|
|
@@ -413,27 +411,28 @@ export interface AssetTransformPlugin extends Partial<AssetTransformHooks> {
|
|
|
413
411
|
export interface ResourceRegistry {
|
|
414
412
|
name: string;
|
|
415
413
|
addResourceProviders(provider: ResourceProvider[]): void;
|
|
414
|
+
addResourceTransformers(provider: UriTransformPlugin[]): void;
|
|
416
415
|
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
|
|
416
|
+
resolveResourceUri<R extends ResourceIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<string>;
|
|
418
417
|
getPublicApi(): PublicResourceRegistry;
|
|
419
418
|
}
|
|
420
|
-
export type PublicResourceRegistry = Pick<ResourceRegistry, 'getResource' | 'resolveResourceUri'>;
|
|
419
|
+
export declare type PublicResourceRegistry = Pick<ResourceRegistry, 'getResource' | 'resolveResourceUri'>;
|
|
421
420
|
export interface AssetRegistry {
|
|
422
421
|
name: string;
|
|
423
422
|
addAssetProviders(provider: AssetProvider[]): void;
|
|
424
|
-
addAssetTransformers(transformers: AssetTransformPlugin[]): void;
|
|
423
|
+
addAssetTransformers(transformers: (AssetTransformPlugin | UriTransformPlugin)[]): void;
|
|
425
424
|
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<
|
|
425
|
+
resolveAssetUri<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<UriDefinition>;
|
|
427
426
|
getPublicApi(): PublicAssetRegistry;
|
|
428
427
|
}
|
|
429
|
-
export type PublicAssetRegistry = Pick<AssetRegistry, 'getAsset' | 'resolveAssetUri'>;
|
|
428
|
+
export declare type PublicAssetRegistry = Pick<AssetRegistry, 'getAsset' | 'resolveAssetUri'>;
|
|
430
429
|
export interface LwcCompilerConfig {
|
|
431
430
|
name: string;
|
|
432
431
|
namespace?: string;
|
|
433
432
|
filename: string;
|
|
434
433
|
scopedStyles?: boolean;
|
|
435
434
|
}
|
|
436
|
-
export type SourceMap = string | null | undefined;
|
|
435
|
+
export declare type SourceMap = string | null | undefined;
|
|
437
436
|
export interface CompiledMetadata {
|
|
438
437
|
imports?: Import[];
|
|
439
438
|
dynamicImports?: DynamicImport[];
|
|
@@ -446,7 +445,7 @@ export interface Import {
|
|
|
446
445
|
moduleSpecifier: string;
|
|
447
446
|
location: SourceLocation;
|
|
448
447
|
}
|
|
449
|
-
export type ModuleNameType = 'string' | 'unresolved';
|
|
448
|
+
export declare type ModuleNameType = 'string' | 'unresolved';
|
|
450
449
|
export interface DynamicImport {
|
|
451
450
|
moduleSpecifier: string;
|
|
452
451
|
location: SourceLocation;
|
|
@@ -541,7 +540,7 @@ export interface GraphDepthOptions {
|
|
|
541
540
|
dynamic: number;
|
|
542
541
|
includeId?: IncludeIdHook;
|
|
543
542
|
}
|
|
544
|
-
export type GraphDepth = 'all' | 'direct' | 'none';
|
|
543
|
+
export declare type GraphDepth = 'all' | 'direct' | 'none';
|
|
545
544
|
export interface FlatGraphNode {
|
|
546
545
|
specifier: Specifier;
|
|
547
546
|
static: Specifier[];
|
|
@@ -551,14 +550,14 @@ export interface GraphNode {
|
|
|
551
550
|
static: Specifier[];
|
|
552
551
|
dynamic: Specifier[];
|
|
553
552
|
}
|
|
554
|
-
export type URIMap = Record<string, string>;
|
|
555
|
-
export type LinkedModuleDefinitionMap = Record<string, LinkedModuleDefinition | BundleDefinition>;
|
|
553
|
+
export declare type URIMap = Record<string, string>;
|
|
554
|
+
export declare type LinkedModuleDefinitionMap = Record<string, LinkedModuleDefinition | BundleDefinition>;
|
|
556
555
|
export interface FlattenedModuleGraphs {
|
|
557
556
|
graphs: FlatGraphNode[];
|
|
558
557
|
uriMap: URIMap;
|
|
559
558
|
linkedDefinitions: LinkedModuleDefinitionMap;
|
|
560
559
|
}
|
|
561
|
-
export type ImportMapImports = {
|
|
560
|
+
export declare type ImportMapImports = {
|
|
562
561
|
[key: string]: string;
|
|
563
562
|
};
|
|
564
563
|
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.14",
|
|
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": "f80dc1c18719b77c183f339027313be11d69f9dc"
|
|
33
33
|
}
|