@lwrjs/types 0.10.0-alpha.15 → 0.10.0-alpha.17
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 +20 -14
- package/build/index.d.ts +52 -40
- package/build/lwr-shim.d.ts +1 -1
- package/build/server.d.ts +10 -9
- 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 +9 -9
- package/build/serviceAPI/serviceAPI.d.ts +3 -3
- package/build/views.d.ts +12 -12
- package/package.json +2 -2
package/build/config.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface View {
|
|
|
8
8
|
}
|
|
9
9
|
export interface LwrBaseRoute extends View {
|
|
10
10
|
properties?: Record<string, any>;
|
|
11
|
-
routeHandler?:
|
|
11
|
+
routeHandler?: ServiceConfig;
|
|
12
12
|
cache?: CacheResponse;
|
|
13
13
|
subRoutes?: string;
|
|
14
14
|
}
|
|
@@ -18,12 +18,14 @@ export interface LwrRoute extends LwrBaseRoute {
|
|
|
18
18
|
}
|
|
19
19
|
export interface NormalizedLwrRoute extends LwrRoute {
|
|
20
20
|
bootstrap: NormalizedLwrAppBootstrapConfig;
|
|
21
|
+
routeHandler?: ServiceEntry;
|
|
21
22
|
}
|
|
22
23
|
export interface LwrErrorRoute extends LwrBaseRoute {
|
|
23
24
|
status: 404 | 500;
|
|
24
25
|
}
|
|
25
26
|
export interface NormalizedLwrErrorRoute extends LwrErrorRoute {
|
|
26
27
|
bootstrap: NormalizedLwrAppBootstrapConfig;
|
|
28
|
+
routeHandler?: ServiceEntry;
|
|
27
29
|
}
|
|
28
30
|
export interface NormalizedLwrAppBootstrapConfig {
|
|
29
31
|
autoBoot: boolean;
|
|
@@ -37,29 +39,32 @@ export interface NormalizedLwrAppBootstrapConfig {
|
|
|
37
39
|
module: string | undefined;
|
|
38
40
|
preloadModules: string[];
|
|
39
41
|
}
|
|
40
|
-
export
|
|
42
|
+
export type LwrAppBootstrapConfig = Partial<NormalizedLwrAppBootstrapConfig>;
|
|
41
43
|
export interface LwrLockerConfig {
|
|
42
44
|
enabled: boolean;
|
|
43
45
|
trustedComponents?: string[];
|
|
44
46
|
clientOnly?: boolean;
|
|
45
47
|
}
|
|
46
48
|
export interface RouteHandlersConfig {
|
|
47
|
-
[id: string]:
|
|
49
|
+
[id: string]: ServiceConfig;
|
|
50
|
+
}
|
|
51
|
+
export interface NormalizedRouteHandlersConfig {
|
|
52
|
+
[id: string]: ServiceEntry;
|
|
48
53
|
}
|
|
49
54
|
export interface LocalizedViewRequest extends ViewRequest {
|
|
50
55
|
locale?: string;
|
|
51
56
|
}
|
|
52
|
-
export
|
|
57
|
+
export type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext, routeHandlerOptions?: any) => Promise<RouteHandlerViewResponse> | RouteHandlerViewResponse;
|
|
53
58
|
export interface ResourcePaths {
|
|
54
59
|
rootDir: string;
|
|
55
60
|
assets: AssetConfig[];
|
|
56
61
|
layoutsDir: string;
|
|
57
62
|
contentDir: string;
|
|
58
63
|
}
|
|
59
|
-
export
|
|
64
|
+
export type RouteHandlerView = Pick<View, 'contentTemplate' | 'layoutTemplate' | 'rootComponent'>;
|
|
60
65
|
export interface RouteHandlerViewApi {
|
|
61
66
|
hasViewResponse(view: RouteHandlerView, viewParams?: ViewParams, renderOptions?: RenderOptions): boolean;
|
|
62
|
-
getViewResponse(view: RouteHandlerView, viewParams?: ViewParams, renderOptions?: RenderOptions): Promise<ViewResponse
|
|
67
|
+
getViewResponse(view: RouteHandlerView, viewParams?: ViewParams, renderOptions?: RenderOptions): Promise<ViewResponse>;
|
|
63
68
|
}
|
|
64
69
|
export interface HandlerContext extends ResourcePaths {
|
|
65
70
|
route: LwrRoute | LwrErrorRoute;
|
|
@@ -115,6 +120,7 @@ export interface BuildOptions {
|
|
|
115
120
|
export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig, 'lwc'>> {
|
|
116
121
|
routes: NormalizedLwrRoute[];
|
|
117
122
|
errorRoutes: NormalizedLwrErrorRoute[];
|
|
123
|
+
routeHandlers: NormalizedRouteHandlersConfig;
|
|
118
124
|
assets: AssetConfig[];
|
|
119
125
|
lwrVersion: string;
|
|
120
126
|
amdLoader: string;
|
|
@@ -158,7 +164,7 @@ export interface Services {
|
|
|
158
164
|
uriTransformers: ResolvedServiceEntry<UriTransformPlugin>[];
|
|
159
165
|
}
|
|
160
166
|
export interface RouteHandlers {
|
|
161
|
-
[id: string]: RouteHandlerFunction;
|
|
167
|
+
[id: string]: [RouteHandlerFunction, any?];
|
|
162
168
|
}
|
|
163
169
|
interface AssetConfigCommon {
|
|
164
170
|
urlPath: string;
|
|
@@ -170,19 +176,19 @@ export interface AssetDirConfig extends AssetConfigCommon {
|
|
|
170
176
|
export interface AssetFileConfig extends AssetConfigCommon {
|
|
171
177
|
file: string;
|
|
172
178
|
}
|
|
173
|
-
export
|
|
179
|
+
export type AssetConfig = AssetDirConfig | AssetFileConfig;
|
|
174
180
|
export interface LwcConfig {
|
|
175
181
|
modules: ResolverModuleRecord[];
|
|
176
182
|
interchangeable?: string[];
|
|
177
183
|
interchangeableModules?: InterchangeableModuleRecord[];
|
|
178
184
|
}
|
|
179
|
-
export
|
|
185
|
+
export type InterchangeableModuleMap = Map<Specifier, Map<Environment, Specifier>>;
|
|
180
186
|
export interface NormalizedLwcConfig extends Omit<LwcConfig, 'interchangeableModules'> {
|
|
181
187
|
interchangeableModulesMap?: InterchangeableModuleMap;
|
|
182
188
|
}
|
|
183
|
-
export
|
|
184
|
-
export
|
|
185
|
-
export
|
|
189
|
+
export type ServiceEntry = [string, any?];
|
|
190
|
+
export type ServiceConfig = string | ServiceEntry;
|
|
191
|
+
export type ResolvedServiceEntry<T extends LwrService> = [ServiceCtor<T>, any?];
|
|
186
192
|
export interface BundleConfig {
|
|
187
193
|
exclude?: string[];
|
|
188
194
|
UNSAFE_lwrDefaultExclude?: string[];
|
|
@@ -193,8 +199,8 @@ export interface BundleConfig {
|
|
|
193
199
|
export interface BundleConfigOverrides extends BundleConfig {
|
|
194
200
|
appendExcludes?: boolean;
|
|
195
201
|
}
|
|
196
|
-
export
|
|
197
|
-
export
|
|
202
|
+
export type BundleGroups = Record<string, string[]>;
|
|
203
|
+
export type Environment = string;
|
|
198
204
|
export interface EnvironmentConfig {
|
|
199
205
|
default?: Environment;
|
|
200
206
|
supported?: Environment[];
|
package/build/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
2
5
|
import type { WatchOptions } from 'chokidar';
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import { Readable } from 'stream';
|
|
6
|
-
import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers, AssetConfig } from './config.js';
|
|
7
|
-
import { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
|
|
6
|
+
import type { EventEmitter } from 'events';
|
|
7
|
+
import type fs from 'fs';
|
|
8
|
+
import type { Readable } from 'stream';
|
|
9
|
+
import type { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers, AssetConfig } from './config.js';
|
|
10
|
+
import type { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
|
|
8
11
|
export * from './lwr-shim.js';
|
|
9
12
|
export * from './config.js';
|
|
10
13
|
export * from './server.js';
|
|
@@ -13,16 +16,16 @@ export * from './serviceAPI/serviceAPI.js';
|
|
|
13
16
|
export * from './serviceAPI/loaderPlugins/loaderPlugins.js';
|
|
14
17
|
export * from './serviceAPI/handleStaleModule/handleStaleModule.js';
|
|
15
18
|
export * from './serviceAPI/appMetadata/appMetadata.js';
|
|
16
|
-
export
|
|
19
|
+
export type Json = undefined | null | boolean | number | string | Json[] | {
|
|
17
20
|
[prop: string]: Json;
|
|
18
21
|
};
|
|
19
|
-
export
|
|
20
|
-
export
|
|
22
|
+
export type Dict<T> = Record<string, T>;
|
|
23
|
+
export type JsonCompatible<T> = {
|
|
21
24
|
[P in keyof T]: T[P] extends Json ? T[P] : Pick<T, P> extends Required<Pick<T, P>> ? never : JsonCompatible<T[P]>;
|
|
22
25
|
};
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
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;
|
|
26
29
|
export interface AbstractModuleId {
|
|
27
30
|
specifier: string;
|
|
28
31
|
namespace?: string;
|
|
@@ -65,7 +68,7 @@ export interface ImportMetadataImports {
|
|
|
65
68
|
export interface ImportMetadataIndex {
|
|
66
69
|
[specifier: string]: string;
|
|
67
70
|
}
|
|
68
|
-
export
|
|
71
|
+
export type ModuleEntry = FsModuleEntry | VirtualModuleEntry;
|
|
69
72
|
interface BaseModuleEntry {
|
|
70
73
|
id: string;
|
|
71
74
|
entry: string;
|
|
@@ -145,8 +148,8 @@ export interface CodeSource {
|
|
|
145
148
|
export interface SignedSource extends CodeSource {
|
|
146
149
|
signedCode?: string;
|
|
147
150
|
}
|
|
148
|
-
export
|
|
149
|
-
export
|
|
151
|
+
export type CompatMode = '0' | '1';
|
|
152
|
+
export type ModuleFormat = 'esm' | 'amd';
|
|
150
153
|
export interface ServerModeConfig {
|
|
151
154
|
format: ModuleFormat;
|
|
152
155
|
bundle: boolean;
|
|
@@ -179,7 +182,7 @@ export interface RuntimeEnvironment extends ServerModeConfig {
|
|
|
179
182
|
export interface SourceMapRuntimeEnvironment extends RuntimeEnvironment {
|
|
180
183
|
sourceMapUrl?: string;
|
|
181
184
|
}
|
|
182
|
-
export
|
|
185
|
+
export type RuntimeParams = Record<string, string | number | boolean | null | undefined | Record<string, string>>;
|
|
183
186
|
export interface ModuleIdentity {
|
|
184
187
|
signature: string;
|
|
185
188
|
moduleId: AbstractModuleId;
|
|
@@ -235,14 +238,14 @@ export interface LwrAppEmitter {
|
|
|
235
238
|
notifyViewSourceChanged(payload: CompiledView): void;
|
|
236
239
|
notifyAssetSourceChanged(payload: AssetSource): void;
|
|
237
240
|
}
|
|
238
|
-
export
|
|
241
|
+
export type EVENT_MODULE_DEFINITION_CHANGED = 'module_definition_changed';
|
|
239
242
|
export interface ModuleDefinitionChangedEvent {
|
|
240
243
|
eventType: EVENT_MODULE_DEFINITION_CHANGED;
|
|
241
244
|
payload: LinkedModuleDefinition;
|
|
242
245
|
}
|
|
243
|
-
export
|
|
244
|
-
export
|
|
245
|
-
export
|
|
246
|
+
export type EVENT_MODULE_SOURCE_CHANGED = 'module_source_changed';
|
|
247
|
+
export type EVENT_ASSET_SOURCE_CHANGED = 'asset_source_changed';
|
|
248
|
+
export type EVENT_VIEW_SOURCE_CHANGED = 'view_source_changed';
|
|
246
249
|
export interface ModuleSourceChangedEvent {
|
|
247
250
|
eventType: EVENT_MODULE_SOURCE_CHANGED;
|
|
248
251
|
payload: ModuleCompiled;
|
|
@@ -260,7 +263,7 @@ export interface ModuleProvider {
|
|
|
260
263
|
getModule<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleCompiled | undefined>;
|
|
261
264
|
getModuleEntry<T extends AbstractModuleId>(moduleId: T, runtimeParams?: RuntimeParams): Promise<ModuleEntry | undefined>;
|
|
262
265
|
}
|
|
263
|
-
export
|
|
266
|
+
export type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
|
|
264
267
|
export interface ServiceCtor<T extends LwrService, R extends Record<string, Json> = {}> {
|
|
265
268
|
new (providerConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
|
|
266
269
|
}
|
|
@@ -274,7 +277,7 @@ export interface ModuleRegistry {
|
|
|
274
277
|
resolveModuleUriSync<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, signature: S, runtimeEnvironment: R, runtimeParams?: RuntimeParams): string;
|
|
275
278
|
getPublicApi(): PublicModuleRegistry;
|
|
276
279
|
}
|
|
277
|
-
export
|
|
280
|
+
export type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'getLinkedModule' | 'resolveModuleUri'>;
|
|
278
281
|
export interface BundleProvider {
|
|
279
282
|
name: string;
|
|
280
283
|
bundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams: RuntimeParams, configOverrides?: BundleConfig): Promise<BundleDefinition | undefined>;
|
|
@@ -286,7 +289,7 @@ export interface ModuleBundler {
|
|
|
286
289
|
resolveModuleUri(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): Promise<string>;
|
|
287
290
|
getPublicApi(): PublicModuleBundler;
|
|
288
291
|
}
|
|
289
|
-
export
|
|
292
|
+
export type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
290
293
|
export interface BundleRecord {
|
|
291
294
|
imports?: BaseModuleReference[];
|
|
292
295
|
dynamicImports?: BaseDynamicModuleReference[];
|
|
@@ -344,7 +347,7 @@ export interface UriDefinition {
|
|
|
344
347
|
entry: string;
|
|
345
348
|
external?: boolean;
|
|
346
349
|
}
|
|
347
|
-
export
|
|
350
|
+
export type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module' | string;
|
|
348
351
|
export interface ResourceDefinition {
|
|
349
352
|
specifier?: string;
|
|
350
353
|
type: ResourceType;
|
|
@@ -371,13 +374,13 @@ export interface AssetSource {
|
|
|
371
374
|
type?: AssetType;
|
|
372
375
|
noTransform?: boolean;
|
|
373
376
|
}
|
|
374
|
-
export
|
|
377
|
+
export type AssetType = 'asset' | 'content-asset' | 'external' | 'unknown';
|
|
375
378
|
export interface AssetDefinition extends AssetSource {
|
|
376
379
|
uri: string;
|
|
377
380
|
type: AssetType;
|
|
378
381
|
stream: (encoding?: BufferEncoding) => Readable;
|
|
379
382
|
}
|
|
380
|
-
export
|
|
383
|
+
export type ResourceJson = Pick<ResourceDefinition, 'type' | 'src'>;
|
|
381
384
|
export interface ResourceProvider {
|
|
382
385
|
name: string;
|
|
383
386
|
getResource<R extends ResourceIdentifier, T extends BootstrapRuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T, runtimeParams?: RuntimeParams): Promise<ResourceDefinition | undefined>;
|
|
@@ -386,22 +389,22 @@ export interface AssetProvider {
|
|
|
386
389
|
name: string;
|
|
387
390
|
getAsset(assetIdentifier: AssetIdentifier): Promise<AssetSource | undefined>;
|
|
388
391
|
}
|
|
389
|
-
export
|
|
390
|
-
export
|
|
391
|
-
export
|
|
392
|
-
export
|
|
392
|
+
export type ArtifactType = 'asset' | 'bundle' | 'resource';
|
|
393
|
+
export type ArtifactDefinition = AssetDefinition | BundleDefinition | ResourceDefinition;
|
|
394
|
+
export type AssetTransformSourceHook = (assetSource: AssetSource, runtimeEnvironment: RuntimeEnvironment) => Promise<AssetTransformSourceHookReturn>;
|
|
395
|
+
export type AssetTransformSourceHookReturn = undefined | {
|
|
393
396
|
source: string | Buffer;
|
|
394
397
|
metadata?: AssetMetadata;
|
|
395
398
|
};
|
|
396
|
-
export
|
|
397
|
-
export
|
|
399
|
+
export type UriTransformHook = (uri: UriDefinition, artifactDef?: ArtifactDefinition, runtimeEnvironment?: RuntimeEnvironment) => Promise<UriTransformHookReturn>;
|
|
400
|
+
export type UriTransformHookReturn = undefined | UriDefinition;
|
|
398
401
|
export interface UriTransformHooks {
|
|
399
402
|
transformUri: UriTransformHook;
|
|
400
403
|
}
|
|
401
404
|
export interface UriTransformPlugin extends UriTransformHooks {
|
|
402
405
|
name: string;
|
|
403
406
|
}
|
|
404
|
-
export
|
|
407
|
+
export type AssetUriTransformHook = (uri: UriDefinition, assetDef: AssetDefinition, runtimeEnvironment: RuntimeEnvironment) => Promise<UriTransformHookReturn>;
|
|
405
408
|
export interface AssetTransformHooks {
|
|
406
409
|
transformUri: AssetUriTransformHook;
|
|
407
410
|
transformSource: AssetTransformSourceHook;
|
|
@@ -417,7 +420,7 @@ export interface ResourceRegistry {
|
|
|
417
420
|
resolveResourceUri<R extends ResourceIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<string>;
|
|
418
421
|
getPublicApi(): PublicResourceRegistry;
|
|
419
422
|
}
|
|
420
|
-
export
|
|
423
|
+
export type PublicResourceRegistry = Pick<ResourceRegistry, 'getResource' | 'resolveResourceUri'>;
|
|
421
424
|
export interface AssetRegistry {
|
|
422
425
|
name: string;
|
|
423
426
|
addAssetProviders(provider: AssetProvider[]): void;
|
|
@@ -426,14 +429,14 @@ export interface AssetRegistry {
|
|
|
426
429
|
resolveAssetUri<R extends AssetIdentifier, T extends RuntimeEnvironment>(resourceIdentity: R, runtimeEnvironment: T): Promise<UriDefinition>;
|
|
427
430
|
getPublicApi(): PublicAssetRegistry;
|
|
428
431
|
}
|
|
429
|
-
export
|
|
432
|
+
export type PublicAssetRegistry = Pick<AssetRegistry, 'getAsset' | 'resolveAssetUri'>;
|
|
430
433
|
export interface LwcCompilerConfig {
|
|
431
434
|
name: string;
|
|
432
435
|
namespace?: string;
|
|
433
436
|
filename: string;
|
|
434
437
|
scopedStyles?: boolean;
|
|
435
438
|
}
|
|
436
|
-
export
|
|
439
|
+
export type SourceMap = string | null | undefined;
|
|
437
440
|
export interface CompiledMetadata {
|
|
438
441
|
imports?: Import[];
|
|
439
442
|
dynamicImports?: DynamicImport[];
|
|
@@ -447,7 +450,7 @@ export interface Import {
|
|
|
447
450
|
moduleSpecifier: string;
|
|
448
451
|
location: SourceLocation;
|
|
449
452
|
}
|
|
450
|
-
export
|
|
453
|
+
export type ModuleNameType = 'string' | 'unresolved';
|
|
451
454
|
export interface DynamicImport {
|
|
452
455
|
moduleSpecifier: string;
|
|
453
456
|
location: SourceLocation;
|
|
@@ -466,6 +469,15 @@ export interface CompilerResult {
|
|
|
466
469
|
export interface BundleFiles {
|
|
467
470
|
[filename: string]: string;
|
|
468
471
|
}
|
|
472
|
+
interface ImportMetaEnv {
|
|
473
|
+
[key: string]: any;
|
|
474
|
+
SSR: boolean;
|
|
475
|
+
}
|
|
476
|
+
declare global {
|
|
477
|
+
interface ImportMeta {
|
|
478
|
+
readonly env: ImportMetaEnv;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
469
481
|
export interface ClientBootstrapConfig {
|
|
470
482
|
appId?: string;
|
|
471
483
|
bootstrapModule: string;
|
|
@@ -546,7 +558,7 @@ export interface GraphDepthOptions {
|
|
|
546
558
|
dynamic: number;
|
|
547
559
|
includeId?: IncludeIdHook;
|
|
548
560
|
}
|
|
549
|
-
export
|
|
561
|
+
export type GraphDepth = 'all' | 'direct' | 'none';
|
|
550
562
|
export interface FlatGraphNode {
|
|
551
563
|
specifier: Specifier;
|
|
552
564
|
static: Specifier[];
|
|
@@ -556,14 +568,14 @@ export interface GraphNode {
|
|
|
556
568
|
static: Specifier[];
|
|
557
569
|
dynamic: Specifier[];
|
|
558
570
|
}
|
|
559
|
-
export
|
|
560
|
-
export
|
|
571
|
+
export type URIMap = Record<string, string>;
|
|
572
|
+
export type LinkedModuleDefinitionMap = Record<string, LinkedModuleDefinition | BundleDefinition>;
|
|
561
573
|
export interface FlattenedModuleGraphs {
|
|
562
574
|
graphs: FlatGraphNode[];
|
|
563
575
|
uriMap: URIMap;
|
|
564
576
|
linkedDefinitions: LinkedModuleDefinitionMap;
|
|
565
577
|
}
|
|
566
|
-
export
|
|
578
|
+
export type ImportMapImports = {
|
|
567
579
|
[key: string]: string;
|
|
568
580
|
};
|
|
569
581
|
export interface LwrBuilderOverwriteOptions {
|
package/build/lwr-shim.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetProvider, HooksPlugin, ModuleProvider, ProviderContext, ResourceProvider, ViewProvider, ViewTransformPlugin } from './index';
|
|
1
|
+
import type { AssetProvider, HooksPlugin, ModuleProvider, ProviderContext, ResourceProvider, ViewProvider, ViewTransformPlugin } from './index';
|
|
2
2
|
interface LwrShim {
|
|
3
3
|
LWC_VERSION: string;
|
|
4
4
|
LEGACY_LOADER: boolean;
|
package/build/server.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { Application as ExpressApp } from 'express';
|
|
4
|
+
import type { default as Koa, Context } from 'koa';
|
|
5
|
+
import type http from 'http';
|
|
6
|
+
import type { Readable } from 'stream';
|
|
6
7
|
import type { NormalizedLwrGlobalConfig, RuntimeContext, RuntimeEnvironment } from './index.js';
|
|
7
|
-
export
|
|
8
|
-
export
|
|
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;
|
|
9
10
|
export interface FsContext extends Context {
|
|
10
11
|
fs?: {
|
|
11
12
|
headers?: http.IncomingHttpHeaders;
|
|
@@ -34,8 +35,8 @@ export interface InternalAppServer<T extends ServerTypes> {
|
|
|
34
35
|
useCompression(): void;
|
|
35
36
|
getRegexWildcard(): string;
|
|
36
37
|
}
|
|
37
|
-
export
|
|
38
|
-
export
|
|
38
|
+
export type PublicAppServer<T extends ServerTypes> = Pick<InternalAppServer<T>, 'use' | 'all' | 'get' | 'post' | 'getRegexWildcard'>;
|
|
39
|
+
export type InternalAppServerOptions = {
|
|
39
40
|
app?: ServerTypeImpl<ServerTypes>;
|
|
40
41
|
basePath?: string;
|
|
41
42
|
};
|
|
@@ -45,7 +46,7 @@ export interface InternalAppServerConstructable {
|
|
|
45
46
|
export interface MiddlewareFunction {
|
|
46
47
|
(req: MiddlewareRequest, res: MiddlewareResponse, next: Function): void;
|
|
47
48
|
}
|
|
48
|
-
export
|
|
49
|
+
export type Headers = http.IncomingHttpHeaders;
|
|
49
50
|
export interface MiddlewareRequest {
|
|
50
51
|
params: any;
|
|
51
52
|
originalUrl: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export interface RegisterHandleStaleModuleHook {
|
|
2
2
|
(hook: HandleStaleModuleHook): void;
|
|
3
3
|
}
|
|
4
|
-
export
|
|
4
|
+
export type HandleStaleModuleHookArgs = {
|
|
5
5
|
name: string;
|
|
6
6
|
oldUrl: string;
|
|
7
7
|
newUrl: string;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type DEPRECIATEDHandleStaleModuleHookArgs = {
|
|
10
10
|
name: string;
|
|
11
11
|
oldHash: string;
|
|
12
12
|
newHash: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ImportMetadata } from '../..';
|
|
2
|
-
|
|
1
|
+
import type { ImportMetadata } from '../..';
|
|
2
|
+
type ResolveParams = {
|
|
3
3
|
parentUrl: string;
|
|
4
4
|
};
|
|
5
5
|
export interface RegisterLoaderHooks {
|
|
6
6
|
(hook: LoaderHooks): void;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export 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
|
|
22
|
+
export type MappingResolveParams = {
|
|
23
23
|
knownModules: string[];
|
|
24
24
|
};
|
|
25
|
-
export
|
|
26
|
-
export
|
|
25
|
+
export type MappingResponse = ImportMetadata | null;
|
|
26
|
+
export type URLResponse = {
|
|
27
27
|
url: string;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type CustomResponse = {
|
|
30
30
|
data: string;
|
|
31
31
|
status: number;
|
|
32
32
|
statusText?: string;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
35
|
-
export
|
|
34
|
+
export type LoadHookResponse = CustomResponse | globalThis.Response | null;
|
|
35
|
+
export type ResolveHookResponse = URLResponse | string | null;
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=loaderPlugins.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RegisterLoaderHooks } from './loaderPlugins/loaderPlugins';
|
|
2
|
-
import { RegisterHandleStaleModuleHook } from './handleStaleModule/handleStaleModule';
|
|
3
|
-
import { AppMetadata } from './appMetadata/appMetadata';
|
|
1
|
+
import type { RegisterLoaderHooks } from './loaderPlugins/loaderPlugins';
|
|
2
|
+
import type { RegisterHandleStaleModuleHook } from './handleStaleModule/handleStaleModule';
|
|
3
|
+
import type { AppMetadata } from './appMetadata/appMetadata';
|
|
4
4
|
export interface ServiceAPI {
|
|
5
5
|
addLoaderPlugin: NoOp | RegisterLoaderHooks;
|
|
6
6
|
handleStaleModule: RegisterHandleStaleModuleHook;
|
package/build/views.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { LwrErrorRoute, LwrRoute, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
|
|
3
|
-
import { AssetSource, UriDefinition, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier } from './index.js';
|
|
4
|
-
export
|
|
2
|
+
import type { LwrErrorRoute, LwrRoute, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
|
|
3
|
+
import type { AssetSource, UriDefinition, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier } from './index.js';
|
|
4
|
+
export 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
|
|
21
|
+
export type NormalizedRenderingResult = Required<RenderingResult>;
|
|
22
22
|
export interface RenderingResult {
|
|
23
23
|
renderedView: string;
|
|
24
24
|
metadata?: RenderedViewMetadata;
|
|
@@ -107,7 +107,7 @@ export interface ViewResponse {
|
|
|
107
107
|
viewDefinition?: LinkedViewDefinition;
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
export
|
|
110
|
+
export type RouteHandlerViewResponse = ViewDefinitionResponse | ViewResponse;
|
|
111
111
|
export interface ViewDefinitionResponse {
|
|
112
112
|
status?: number;
|
|
113
113
|
view: RouteHandlerView;
|
|
@@ -133,13 +133,13 @@ export interface ViewTransformPluginContext {
|
|
|
133
133
|
};
|
|
134
134
|
importer?: string;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
type ViewPluginLinkHook = (builder: LwrStringBuilder, viewContext: ViewTransformPluginContext, viewMetadata: RenderedViewMetadata) => Promise<ViewPluginLinkHookReturn>;
|
|
137
|
+
type ViewPluginLinkHookReturn = void | null | undefined | false | LwrStringBuilder | {
|
|
138
138
|
builder?: LwrStringBuilder;
|
|
139
139
|
cache?: CacheResponse;
|
|
140
140
|
};
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
type ViewPluginOptimizeHook = (code: string, assetSource: AssetSource) => Promise<ViewPluginOptimizeHookReturn>;
|
|
142
|
+
type ViewPluginOptimizeHookReturn = null | undefined | false | string | {
|
|
143
143
|
code: string;
|
|
144
144
|
map?: any;
|
|
145
145
|
};
|
|
@@ -150,7 +150,7 @@ export interface ViewTransformHooks {
|
|
|
150
150
|
export interface ViewTransformPlugin extends Partial<ViewTransformHooks> {
|
|
151
151
|
name: string;
|
|
152
152
|
}
|
|
153
|
-
export
|
|
153
|
+
export type ViewParams = Record<string, Json>;
|
|
154
154
|
export interface ViewInfo {
|
|
155
155
|
id: string;
|
|
156
156
|
url: string;
|
|
@@ -167,7 +167,7 @@ export interface ViewPageContext {
|
|
|
167
167
|
title?: string;
|
|
168
168
|
url: string;
|
|
169
169
|
}
|
|
170
|
-
export
|
|
170
|
+
export type ViewModuleResourceContext = {
|
|
171
171
|
isPreload?: boolean;
|
|
172
172
|
isSSR?: boolean;
|
|
173
173
|
async?: boolean;
|
|
@@ -181,7 +181,7 @@ export interface ViewRegistry {
|
|
|
181
181
|
hasViewDefinition<R extends RuntimeEnvironment>(view: View, viewParams: ViewParams, runtimeEnvironment: R, runtimeParams?: RuntimeParams, renderOptions?: RenderOptions): boolean;
|
|
182
182
|
getPublicApi(): PublicViewRegistry;
|
|
183
183
|
}
|
|
184
|
-
export
|
|
184
|
+
export type PublicViewRegistry = Pick<ViewRegistry, 'getView' | 'getViewDefinition'>;
|
|
185
185
|
export interface ViewHandler {
|
|
186
186
|
getViewContent(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
|
|
187
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.17",
|
|
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": "36cfce3a18bf3dc71a7d5203bbaa9aa752ccce06"
|
|
33
33
|
}
|