@lwrjs/types 0.9.0-alpha.15 → 0.9.0-alpha.16
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 +33 -3
- package/build/index.d.ts +16 -8
- package/package.json +8 -4
package/build/config.d.ts
CHANGED
|
@@ -83,7 +83,6 @@ export interface LwrGlobalConfig {
|
|
|
83
83
|
environment?: EnvironmentConfig;
|
|
84
84
|
lwc?: LwcConfig;
|
|
85
85
|
moduleProviders?: ServiceConfig[];
|
|
86
|
-
bundleProviders?: ServiceConfig[];
|
|
87
86
|
resourceProviders?: ServiceConfig[];
|
|
88
87
|
viewProviders?: ServiceConfig[];
|
|
89
88
|
viewTransformers?: ServiceConfig[];
|
|
@@ -103,7 +102,6 @@ export interface NormalizedLwrGlobalConfig extends Required<Omit<LwrGlobalConfig
|
|
|
103
102
|
esmLoader: string;
|
|
104
103
|
hooks: ServiceEntry[];
|
|
105
104
|
moduleProviders: ServiceEntry[];
|
|
106
|
-
bundleProviders: ServiceEntry[];
|
|
107
105
|
viewProviders: ServiceEntry[];
|
|
108
106
|
viewTransformers: ServiceEntry[];
|
|
109
107
|
resourceProviders: ServiceEntry[];
|
|
@@ -123,6 +121,7 @@ export interface ServerBuild {
|
|
|
123
121
|
appConfig: NormalizedLwrGlobalConfig;
|
|
124
122
|
runtimeEnvironment: RuntimeEnvironment;
|
|
125
123
|
globalData: GlobalData;
|
|
124
|
+
hooks: HooksPlugin[];
|
|
126
125
|
services: Services;
|
|
127
126
|
routes: Route<NormalizedLwrRoute>[];
|
|
128
127
|
errorRoutes: Route<NormalizedLwrErrorRoute>[];
|
|
@@ -168,6 +167,9 @@ export interface BundleConfig {
|
|
|
168
167
|
external?: Record<string, string>;
|
|
169
168
|
alias?: Record<string, string>;
|
|
170
169
|
}
|
|
170
|
+
export interface BundleConfigOverrides extends BundleConfig {
|
|
171
|
+
appendExcludes?: boolean;
|
|
172
|
+
}
|
|
171
173
|
export declare type Environment = string;
|
|
172
174
|
export interface EnvironmentConfig {
|
|
173
175
|
default?: Environment;
|
|
@@ -194,7 +196,35 @@ export interface InterchangeableModuleRecord {
|
|
|
194
196
|
};
|
|
195
197
|
}
|
|
196
198
|
export interface HooksPlugin {
|
|
197
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Programmatically modify application and runtime configurations.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* These hooks are invoked both at build time and runtime for Express and Koa(not MRT).
|
|
204
|
+
*
|
|
205
|
+
* During server build, config hooks are invoked prior to static site generation
|
|
206
|
+
* and server bundling.
|
|
207
|
+
*
|
|
208
|
+
* For the `createServer`(ie. Express/Koa) runtime, these config hooks are invoked before all other hooks
|
|
209
|
+
* during server context initialization
|
|
210
|
+
*
|
|
211
|
+
* For the `createHandler`(ie. MRT Serverless Express) runtime, these config hooks are NOT invoked. This runtime does
|
|
212
|
+
* not support asynchronous execution during initialization. These hooks MUST be ran during
|
|
213
|
+
* the server build.
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
initConfigs?: (lwrConfig: NormalizedLwrGlobalConfig, dataConfig: GlobalData, runtimeConfig: RuntimeEnvironment) => Promise<void> | void;
|
|
217
|
+
/**
|
|
218
|
+
* Load routes on application start up.
|
|
219
|
+
*
|
|
220
|
+
* @remarks
|
|
221
|
+
* These hooks are invoked ONLY at runtime.
|
|
222
|
+
*
|
|
223
|
+
* For the `createServer` runtime, these hooks are invoked AFTER config hooks.
|
|
224
|
+
*
|
|
225
|
+
* For the `createHandler` runtime, these hooks are invoked during server context initialization.
|
|
226
|
+
*/
|
|
227
|
+
onStart?: (routes: LwrRoute[]) => void;
|
|
198
228
|
}
|
|
199
229
|
export {};
|
|
200
230
|
//# sourceMappingURL=config.d.ts.map
|
package/build/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { WatchOptions } from 'chokidar';
|
|
|
6
6
|
import { EventEmitter } from 'events';
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import { Readable } from 'stream';
|
|
9
|
-
import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord } from './config.js';
|
|
9
|
+
import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, LwrRoute, LwrErrorRoute, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, Route, BundleConfigOverrides } from './config.js';
|
|
10
10
|
import { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
|
|
11
11
|
export * from './lwr-shim.js';
|
|
12
12
|
export * from './config.js';
|
|
@@ -278,8 +278,8 @@ export interface BundleProvider {
|
|
|
278
278
|
}
|
|
279
279
|
export interface ModuleBundler {
|
|
280
280
|
addBundleProviders(providers: BundleProvider[]): void;
|
|
281
|
-
getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?:
|
|
282
|
-
resolveModuleUri
|
|
281
|
+
getModuleBundle<T extends AbstractModuleId, R extends RuntimeEnvironment>(moduleId: T, runtimeEnvironment: R, runtimeParams?: RuntimeParams, bundleConfigOverrides?: BundleConfigOverrides): Promise<BundleDefinition>;
|
|
282
|
+
resolveModuleUri(moduleId: Required<Pick<ModuleId, 'specifier' | 'version'>>, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): Promise<string>;
|
|
283
283
|
getPublicApi(): PublicModuleBundler;
|
|
284
284
|
}
|
|
285
285
|
export declare type PublicModuleBundler = Pick<ModuleBundler, 'getModuleBundle' | 'resolveModuleUri'>;
|
|
@@ -293,6 +293,7 @@ export interface BundleDefinition extends ModuleId {
|
|
|
293
293
|
config: BundleConfig;
|
|
294
294
|
map?: any;
|
|
295
295
|
bundleRecord: BundleRecord;
|
|
296
|
+
src?: string;
|
|
296
297
|
}
|
|
297
298
|
export interface ProviderAppConfig {
|
|
298
299
|
modules: ResolverModuleRecord[];
|
|
@@ -320,6 +321,7 @@ export interface ProviderContext {
|
|
|
320
321
|
config: ProviderAppConfig;
|
|
321
322
|
runtimeEnvironment: RuntimeEnvironment;
|
|
322
323
|
watcherFactory?: WatcherFactory;
|
|
324
|
+
siteMetadata?: SiteMetadata;
|
|
323
325
|
}
|
|
324
326
|
export interface ResourceIdentifier {
|
|
325
327
|
specifier: string;
|
|
@@ -335,7 +337,7 @@ export interface AssetUri {
|
|
|
335
337
|
immutable: boolean;
|
|
336
338
|
entry: string;
|
|
337
339
|
}
|
|
338
|
-
export declare type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module';
|
|
340
|
+
export declare type ResourceType = 'application/javascript' | 'application/json' | 'text/css' | 'lwr-importmap' | 'module' | string;
|
|
339
341
|
export interface ResourceDefinition {
|
|
340
342
|
specifier?: string;
|
|
341
343
|
type: ResourceType;
|
|
@@ -345,7 +347,7 @@ export interface ResourceDefinition {
|
|
|
345
347
|
defer?: boolean;
|
|
346
348
|
nonce?: string;
|
|
347
349
|
content?: string;
|
|
348
|
-
stream?: Readable;
|
|
350
|
+
stream?: () => Readable;
|
|
349
351
|
isPreload?: boolean;
|
|
350
352
|
}
|
|
351
353
|
export interface AssetMetadata {
|
|
@@ -498,10 +500,12 @@ export interface ServerContext {
|
|
|
498
500
|
viewRegistry: ViewRegistry;
|
|
499
501
|
resourceRegistry: ResourceRegistry;
|
|
500
502
|
assetRegistry: AssetRegistry;
|
|
501
|
-
appConfig: NormalizedLwrGlobalConfig;
|
|
502
|
-
runtimeEnvironment: RuntimeEnvironment;
|
|
503
503
|
watcherFactory?: WatcherFactory;
|
|
504
504
|
siteMetadata?: SiteMetadata;
|
|
505
|
+
appConfig: NormalizedLwrGlobalConfig;
|
|
506
|
+
runtimeEnvironment: RuntimeEnvironment;
|
|
507
|
+
routes: Route<LwrRoute>[];
|
|
508
|
+
errorRoutes: Route<LwrErrorRoute>[];
|
|
505
509
|
}
|
|
506
510
|
export interface Observer<V> {
|
|
507
511
|
next: (value: V) => void;
|
|
@@ -579,6 +583,10 @@ export interface LwrStringBuilder {
|
|
|
579
583
|
original: string;
|
|
580
584
|
}
|
|
581
585
|
export interface SiteMetadata {
|
|
586
|
+
/**
|
|
587
|
+
* Get the path that all site metadata is relative to
|
|
588
|
+
*/
|
|
589
|
+
getSiteRootDir(): string;
|
|
582
590
|
/**
|
|
583
591
|
* Get the current metadata about the pre-built module bundles for the site.
|
|
584
592
|
*/
|
|
@@ -624,7 +632,7 @@ export interface SiteArtifact {
|
|
|
624
632
|
export interface SiteBundle extends SiteArtifact {
|
|
625
633
|
version?: Version;
|
|
626
634
|
bundleRecord: {
|
|
627
|
-
includedModules
|
|
635
|
+
includedModules?: string[];
|
|
628
636
|
imports: string[];
|
|
629
637
|
};
|
|
630
638
|
}
|
package/package.json
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"build": "tsc -b"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
-
"version": "0.9.0-alpha.
|
|
11
|
+
"version": "0.9.0-alpha.16",
|
|
12
12
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/salesforce/lwr.git",
|
|
15
|
+
"url": "https://github.com/salesforce-experience-platform-emu/lwr.git",
|
|
16
16
|
"directory": "packages/@lwrjs/types"
|
|
17
17
|
},
|
|
18
18
|
"bugs": {
|
|
19
|
-
"url": "https://github.com/salesforce/lwr/issues"
|
|
19
|
+
"url": "https://github.com/salesforce-experience-platform-emu/lwr/issues"
|
|
20
20
|
},
|
|
21
21
|
"main": "build/index.js",
|
|
22
22
|
"files": [
|
|
@@ -29,5 +29,9 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"chokidar": "^3.5.3"
|
|
31
31
|
},
|
|
32
|
-
"
|
|
32
|
+
"volta": {
|
|
33
|
+
"node": "14.19.1",
|
|
34
|
+
"yarn": "1.22.19"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "03fe3982780e7c63b96ef0733b58529057db61fa"
|
|
33
37
|
}
|