@lwrjs/types 0.9.0-alpha.12 → 0.9.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 +23 -1
- package/build/index.d.ts +73 -24
- package/build/views.d.ts +5 -5
- package/package.json +5 -2
package/build/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CacheResponse, RenderOptions, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, Specifier, ViewParams, ViewRequest, ViewResponse } from './index';
|
|
1
|
+
import { AssetProvider, AssetTransformPlugin, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerTypes, ServiceCtor, Specifier, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
|
|
2
2
|
export interface View {
|
|
3
3
|
id: string;
|
|
4
4
|
rootComponent?: string;
|
|
@@ -100,6 +100,7 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
|
|
|
100
100
|
lwrVersion: string;
|
|
101
101
|
amdLoader: string;
|
|
102
102
|
esmLoader: string;
|
|
103
|
+
hooks: ServiceEntry[];
|
|
103
104
|
moduleProviders: ServiceEntry[];
|
|
104
105
|
viewProviders: ServiceEntry[];
|
|
105
106
|
viewTransformers: ServiceEntry[];
|
|
@@ -111,10 +112,30 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
|
|
|
111
112
|
export interface StaticSiteGenerator {
|
|
112
113
|
outputDir?: string;
|
|
113
114
|
locales?: string[];
|
|
115
|
+
skipCleanOutputDir?: boolean;
|
|
114
116
|
skipBaseDocumentGeneration?: boolean;
|
|
115
117
|
_additionalRoutePaths?: string[];
|
|
116
118
|
_additionalModules?: string[];
|
|
117
119
|
}
|
|
120
|
+
export interface ServerBuild {
|
|
121
|
+
appConfig: NormalizedLwrGlobalConfig;
|
|
122
|
+
runtimeEnvironment: RuntimeEnvironment;
|
|
123
|
+
globalData: GlobalData;
|
|
124
|
+
services: Services;
|
|
125
|
+
routes: Route<NormalizedLwrRoute>[];
|
|
126
|
+
errorRoutes: Route<NormalizedLwrErrorRoute>[];
|
|
127
|
+
}
|
|
128
|
+
export interface Services {
|
|
129
|
+
moduleProviders: ResolvedServiceEntry<ModuleProvider>[];
|
|
130
|
+
viewProviders: ResolvedServiceEntry<ViewProvider>[];
|
|
131
|
+
viewTransformers: ResolvedServiceEntry<ViewTransformPlugin>[];
|
|
132
|
+
resourceProviders: ResolvedServiceEntry<ResourceProvider>[];
|
|
133
|
+
assetProviders: ResolvedServiceEntry<AssetProvider>[];
|
|
134
|
+
assetTransformers: ResolvedServiceEntry<AssetTransformPlugin>[];
|
|
135
|
+
}
|
|
136
|
+
export declare type Route<T extends LwrBaseRoute> = (T extends LwrRoute ? Omit<NormalizedLwrRoute, 'routeHandler'> : Omit<NormalizedLwrErrorRoute, 'routeHandler'>) & {
|
|
137
|
+
routeHandler?: RouteHandlerFunction;
|
|
138
|
+
};
|
|
118
139
|
interface AssetConfigCommon {
|
|
119
140
|
urlPath: string;
|
|
120
141
|
alias?: string;
|
|
@@ -137,6 +158,7 @@ export interface NormalizedLwcConfig extends Omit<LwcConfig, 'interchangeableMod
|
|
|
137
158
|
}
|
|
138
159
|
export declare type ServiceEntry = [string, any?];
|
|
139
160
|
export declare type ServiceConfig = string | ServiceEntry;
|
|
161
|
+
export declare type ResolvedServiceEntry<T extends LwrService> = [ServiceCtor<T>, any?];
|
|
140
162
|
export interface BundleConfig {
|
|
141
163
|
exclude?: string[];
|
|
142
164
|
UNSAFE_lwrDefaultExclude?: string[];
|
package/build/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
/// <reference types="node" />
|
|
5
|
+
import type { WatchOptions } from 'chokidar';
|
|
5
6
|
import { EventEmitter } from 'events';
|
|
6
7
|
import fs from 'fs';
|
|
7
8
|
import { Readable } from 'stream';
|
|
@@ -162,9 +163,10 @@ export interface ServerModeConfig {
|
|
|
162
163
|
};
|
|
163
164
|
featureFlags: FeatureFlags;
|
|
164
165
|
}
|
|
165
|
-
export interface FeatureFlags {
|
|
166
|
-
LEGACY_LOADER
|
|
167
|
-
SSR_STATIC_BUNDLES
|
|
166
|
+
export interface FeatureFlags extends Record<string, boolean | undefined> {
|
|
167
|
+
LEGACY_LOADER?: boolean;
|
|
168
|
+
SSR_STATIC_BUNDLES?: boolean;
|
|
169
|
+
SSR_SANDBOX_WORKER?: boolean;
|
|
168
170
|
}
|
|
169
171
|
export interface RuntimeEnvironment extends ServerModeConfig {
|
|
170
172
|
apiVersion: string;
|
|
@@ -200,6 +202,11 @@ export interface BootstrapRuntimeEnvironment extends RuntimeEnvironment {
|
|
|
200
202
|
bootstrapImports?: string[];
|
|
201
203
|
bootstrapDynamicImports?: string[];
|
|
202
204
|
}
|
|
205
|
+
export type { WatchOptions } from 'chokidar';
|
|
206
|
+
export interface WatcherFactory {
|
|
207
|
+
createFileWatcher(options?: WatchOptions): Watcher;
|
|
208
|
+
setupWatcher(onModuleChange: Function): Watcher;
|
|
209
|
+
}
|
|
203
210
|
export interface Watcher extends EventEmitter {
|
|
204
211
|
add(paths: string | ReadonlyArray<string>): void;
|
|
205
212
|
unwatch(paths: string | ReadonlyArray<string>): void;
|
|
@@ -253,7 +260,7 @@ export interface ModuleProvider {
|
|
|
253
260
|
}
|
|
254
261
|
export declare type LwrService = ModuleProvider | ResourceProvider | ViewProvider | AssetProvider | HooksPlugin | AssetTransformPlugin | ViewTransformPlugin;
|
|
255
262
|
export interface ServiceCtor<T extends LwrService, R extends Record<string, Json> = {}> {
|
|
256
|
-
new (
|
|
263
|
+
new (providerConfig: R, serviceProviderConfig?: any, ...args: any[]): T;
|
|
257
264
|
}
|
|
258
265
|
export interface ModuleRegistry {
|
|
259
266
|
name: string;
|
|
@@ -265,10 +272,16 @@ export interface ModuleRegistry {
|
|
|
265
272
|
getPublicApi(): PublicModuleRegistry;
|
|
266
273
|
}
|
|
267
274
|
export declare type PublicModuleRegistry = Pick<ModuleRegistry, 'getModule' | 'getModuleEntry' | 'resolveModuleUri'>;
|
|
275
|
+
export interface BundleProvider {
|
|
276
|
+
name: string;
|
|
277
|
+
bundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams: RuntimeParams, configOverrides?: BundleConfig): Promise<BundleDefinition | undefined>;
|
|
278
|
+
}
|
|
268
279
|
export interface ModuleBundler {
|
|
280
|
+
addBundleProviders(providers: BundleProvider[]): void;
|
|
269
281
|
getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfig): Promise<BundleDefinition>;
|
|
282
|
+
resolveModuleUri<R extends RuntimeEnvironment, S extends string | undefined>(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: R, runtimeParams?: RuntimeParams, signature?: S): S extends string ? string : Promise<string>;
|
|
270
283
|
}
|
|
271
|
-
export declare type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle'>;
|
|
284
|
+
export declare type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
272
285
|
export interface BundleRecord {
|
|
273
286
|
imports?: BaseModuleReference[];
|
|
274
287
|
dynamicImports?: BaseDynamicModuleReference[];
|
|
@@ -293,9 +306,9 @@ export interface ProviderAppConfig {
|
|
|
293
306
|
amdLoader: string;
|
|
294
307
|
esmLoader: string;
|
|
295
308
|
environment?: EnvironmentConfig;
|
|
309
|
+
bundleConfig: BundleConfig;
|
|
296
310
|
}
|
|
297
311
|
export interface ProviderContext {
|
|
298
|
-
compiler: Compiler;
|
|
299
312
|
appObserver: Pick<LwrAppObserver, 'onModuleDefinitionChange' | 'onModuleSourceChange' | 'onAssetSourceChange' | 'onViewSourceChange'>;
|
|
300
313
|
appEmitter: Pick<LwrAppEmitter, 'notifyModuleDefinitionChanged' | 'notifyAssetSourceChanged' | 'notifyModuleSourceChanged' | 'notifyViewSourceChanged'>;
|
|
301
314
|
moduleRegistry: PublicModuleRegistry;
|
|
@@ -305,6 +318,7 @@ export interface ProviderContext {
|
|
|
305
318
|
assetRegistry: PublicAssetRegistry;
|
|
306
319
|
config: ProviderAppConfig;
|
|
307
320
|
runtimeEnvironment: RuntimeEnvironment;
|
|
321
|
+
watcherFactory?: WatcherFactory;
|
|
308
322
|
}
|
|
309
323
|
export interface ResourceIdentifier {
|
|
310
324
|
specifier: string;
|
|
@@ -402,7 +416,7 @@ export interface AssetRegistry {
|
|
|
402
416
|
getPublicApi(): PublicAssetRegistry;
|
|
403
417
|
}
|
|
404
418
|
export declare type PublicAssetRegistry = Pick<AssetRegistry, 'getAsset' | 'resolveAssetUri'>;
|
|
405
|
-
export interface
|
|
419
|
+
export interface LwcCompilerConfig {
|
|
406
420
|
name: string;
|
|
407
421
|
namespace?: string;
|
|
408
422
|
filename: string;
|
|
@@ -436,22 +450,6 @@ export interface CompilerResult {
|
|
|
436
450
|
export interface BundleFiles {
|
|
437
451
|
[filename: string]: string;
|
|
438
452
|
}
|
|
439
|
-
export interface Compiler {
|
|
440
|
-
convertToAmd(source: string, { id }: {
|
|
441
|
-
id: string;
|
|
442
|
-
}): Promise<CompilerResult>;
|
|
443
|
-
getModuleMetadata(compiledSource: string): Promise<Partial<CompiledMetadata>>;
|
|
444
|
-
lockerize(compiledModule: ModuleCompiled, lockerConfig: LwrLockerConfig, sourcemap: boolean): CompilerResult;
|
|
445
|
-
minifyJavascript(source: string): Promise<CompilerResult>;
|
|
446
|
-
parseJavascript(source: string, options: ParseOptions): Promise<CompilerResult>;
|
|
447
|
-
minifyCSS(source: string): Promise<CompilerResult>;
|
|
448
|
-
}
|
|
449
|
-
export interface ParseOptions {
|
|
450
|
-
envMode: string;
|
|
451
|
-
}
|
|
452
|
-
export interface CompilerContext {
|
|
453
|
-
runtimeEnvironment: RuntimeEnvironment;
|
|
454
|
-
}
|
|
455
453
|
export interface ClientBootstrapConfig {
|
|
456
454
|
appId?: string;
|
|
457
455
|
bootstrapModule: string;
|
|
@@ -494,7 +492,6 @@ export interface MetricsConfig {
|
|
|
494
492
|
export interface ServerContext {
|
|
495
493
|
appObserver: LwrAppObserver;
|
|
496
494
|
appEmitter: LwrAppEmitter;
|
|
497
|
-
compiler: Compiler;
|
|
498
495
|
moduleRegistry: ModuleRegistry;
|
|
499
496
|
moduleBundler: ModuleBundler;
|
|
500
497
|
viewRegistry: ViewRegistry;
|
|
@@ -502,6 +499,8 @@ export interface ServerContext {
|
|
|
502
499
|
assetRegistry: AssetRegistry;
|
|
503
500
|
appConfig: NormalizedLwrGlobalConfig;
|
|
504
501
|
runtimeEnvironment: RuntimeEnvironment;
|
|
502
|
+
watcherFactory?: WatcherFactory;
|
|
503
|
+
siteMetadata?: SiteMetadata;
|
|
505
504
|
}
|
|
506
505
|
export interface Observer<V> {
|
|
507
506
|
next: (value: V) => void;
|
|
@@ -578,4 +577,54 @@ export interface LwrStringBuilder {
|
|
|
578
577
|
toString(): string;
|
|
579
578
|
original: string;
|
|
580
579
|
}
|
|
580
|
+
export interface SiteMetadata {
|
|
581
|
+
/**
|
|
582
|
+
* Get the current metadata about the pre-built module bundles for the site.
|
|
583
|
+
*/
|
|
584
|
+
getSiteBundles(): SiteBundles;
|
|
585
|
+
/**
|
|
586
|
+
* Get the current metadata about the pre-built resources for the site.
|
|
587
|
+
*/
|
|
588
|
+
getSiteResources(): SiteResources;
|
|
589
|
+
/**
|
|
590
|
+
* Get the current metadata about the pre-built assets for the site.
|
|
591
|
+
*/
|
|
592
|
+
getSiteAssets(): SiteAssets;
|
|
593
|
+
/**
|
|
594
|
+
* To save out metadata for the current site
|
|
595
|
+
* @param staticRoot
|
|
596
|
+
* @returns
|
|
597
|
+
*/
|
|
598
|
+
persistSiteMetadata(): Promise<void>;
|
|
599
|
+
}
|
|
600
|
+
export interface SiteBundles {
|
|
601
|
+
environment: SiteBundlesEnvironment;
|
|
602
|
+
bundles: Record<string, SiteBundle>;
|
|
603
|
+
}
|
|
604
|
+
export interface SiteResources {
|
|
605
|
+
environment: SiteResourcesEnvironment;
|
|
606
|
+
resources: Record<string, SiteArtifact>;
|
|
607
|
+
}
|
|
608
|
+
export interface SiteAssets {
|
|
609
|
+
assets: Record<string, SiteArtifact>;
|
|
610
|
+
}
|
|
611
|
+
export interface SiteBundlesEnvironment {
|
|
612
|
+
format: ModuleFormat;
|
|
613
|
+
featureFlags?: FeatureFlags;
|
|
614
|
+
}
|
|
615
|
+
export interface SiteResourcesEnvironment {
|
|
616
|
+
format: ModuleFormat;
|
|
617
|
+
featureFlags?: FeatureFlags;
|
|
618
|
+
}
|
|
619
|
+
export interface SiteArtifact {
|
|
620
|
+
path: string;
|
|
621
|
+
mimeType?: string;
|
|
622
|
+
}
|
|
623
|
+
export interface SiteBundle extends SiteArtifact {
|
|
624
|
+
version?: Version;
|
|
625
|
+
bundleRecord: {
|
|
626
|
+
includedModules: string[];
|
|
627
|
+
imports: string[];
|
|
628
|
+
};
|
|
629
|
+
}
|
|
581
630
|
//# sourceMappingURL=index.d.ts.map
|
package/build/views.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { RouteHandlerFunction, RouteHandlerView, View } from './config.js';
|
|
3
|
-
import { AssetSource, AssetUri, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json,
|
|
2
|
+
import { LwrErrorRoute, LwrRoute, Route, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
|
|
3
|
+
import { AssetSource, AssetUri, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier, TransformPluginContext } from './index.js';
|
|
4
4
|
export declare type ViewIdentity = Pick<View, 'rootComponent' | 'contentTemplate'>;
|
|
5
5
|
export interface ViewSource {
|
|
6
6
|
name: string;
|
|
@@ -185,9 +185,9 @@ export interface ViewRegistry {
|
|
|
185
185
|
}
|
|
186
186
|
export declare type PublicViewRegistry = Pick<ViewRegistry, 'getView' | 'getViewDefinition'>;
|
|
187
187
|
export interface ViewHandler {
|
|
188
|
-
getViewContent(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute
|
|
189
|
-
getViewJson(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute
|
|
190
|
-
getViewConfiguration(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute
|
|
188
|
+
getViewContent(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
|
|
189
|
+
getViewJson(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
|
|
190
|
+
getViewConfiguration(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse | undefined>;
|
|
191
191
|
}
|
|
192
192
|
export interface SsrRequestContext {
|
|
193
193
|
props: Json;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "tsc -b"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
-
"version": "0.9.0-alpha.
|
|
11
|
+
"version": "0.9.0-alpha.14",
|
|
12
12
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -26,5 +26,8 @@
|
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=14.15.4 <19"
|
|
28
28
|
},
|
|
29
|
-
"
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"chokidar": "^3.5.3"
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "64e0ba617151429da6e09f1a9686628f64183d25"
|
|
30
33
|
}
|