@lwrjs/types 0.13.0-alpha.2 → 0.13.0-alpha.21

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 CHANGED
@@ -1,4 +1,4 @@
1
- import type { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerContext, ServerTypes, ServiceCtor, Specifier, UriTransformPlugin, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index';
1
+ import type { AssetProvider, AssetTransformPlugin, BundleProvider, CacheResponse, LwrService, ModuleProvider, RenderOptions, ResourceProvider, RouteHandlerViewResponse, RuntimeEnvironment, ServerContext, ServerTypes, ServiceCtor, Specifier, UriTransformPlugin, ViewParams, ViewProvider, ViewRequest, ViewResponse, ViewTransformPlugin } from './index.js';
2
2
  export interface View {
3
3
  id: string;
4
4
  rootComponent?: string;
@@ -44,6 +44,8 @@ export interface LwrAppBootstrapConfig {
44
44
  mixedMode?: boolean;
45
45
  module?: string | undefined;
46
46
  preloadModules?: string[];
47
+ lwrVersion?: string;
48
+ lwcVersion?: string;
47
49
  }
48
50
  export interface NormalizedLwrAppBootstrapConfig extends Required<Omit<LwrAppBootstrapConfig, 'module'>> {
49
51
  services: BootstrapService[];
@@ -62,6 +64,8 @@ export interface NormalizedRouteHandlersConfig {
62
64
  export interface LocalizedViewRequest extends ViewRequest {
63
65
  locale?: string;
64
66
  basePath?: string;
67
+ assetBasePath?: string;
68
+ uiBasePath?: string;
65
69
  }
66
70
  export type RouteHandlerFunction = (viewRequest: LocalizedViewRequest, handlerContext: HandlerContext, routeHandlerOptions?: any) => Promise<RouteHandlerViewResponse> | RouteHandlerViewResponse;
67
71
  export interface ResourcePaths {
package/build/index.d.ts CHANGED
@@ -174,6 +174,7 @@ export interface FeatureFlags extends Record<string, boolean | string | undefine
174
174
  SSR_STATIC_BUNDLES?: boolean;
175
175
  SSR_WITH_CSR_FALLBACK?: boolean;
176
176
  EXPERIMENTAL_UNVERSIONED_ALIASES?: boolean;
177
+ ENABLE_NONCE?: boolean;
177
178
  }
178
179
  export interface RuntimeEnvironment extends ServerModeConfig {
179
180
  apiVersion: string;
@@ -313,6 +314,7 @@ export interface BundleDefinition extends ModuleId {
313
314
  map?: any;
314
315
  bundleRecord: BundleRecord;
315
316
  src?: string;
317
+ integrity?: string;
316
318
  }
317
319
  export interface ProviderAppConfig {
318
320
  modules: ResolverModuleRecord[];
@@ -365,6 +367,7 @@ export interface ResourceDefinition {
365
367
  specifier?: string;
366
368
  type: ResourceType;
367
369
  src?: string;
370
+ entry?: string;
368
371
  inline?: boolean;
369
372
  async?: boolean;
370
373
  defer?: boolean;
@@ -372,6 +375,8 @@ export interface ResourceDefinition {
372
375
  content?: string;
373
376
  stream?: () => Readable;
374
377
  isPreload?: boolean;
378
+ version?: string;
379
+ integrity?: string;
375
380
  }
376
381
  export interface AssetMetadata {
377
382
  assetReferences?: AssetReference[];
@@ -512,11 +517,8 @@ export interface ClientBootstrapConfig {
512
517
  imports?: ImportMetadataImports;
513
518
  index?: ImportMetadataIndex;
514
519
  metricsConfig?: MetricsConfig;
515
- /**
516
- /* @deprecated for mapping endpoint syntax
517
- /* Import map for the loader to resolve modules, defaults to a "lwr-importmap" script tag
518
- */
519
520
  importMappings?: object;
521
+ env?: any;
520
522
  }
521
523
  export interface Endpoints {
522
524
  uris: Record<string, string>;
@@ -623,6 +625,16 @@ export interface LwrStringBuilder {
623
625
  toString(): string;
624
626
  original: string;
625
627
  }
628
+ export interface DecisionTree<Artifact extends SiteArtifact> {
629
+ /**
630
+ * Insert an artifact into the tree based on a path of decisions
631
+ */
632
+ insert(siteArtifactId: string, artifact: Artifact, debug?: boolean, localeFallbacks?: Record<string, string[]>): void;
633
+ /**
634
+ * Retrieve an artifact from the tree based on a path of decisions
635
+ */
636
+ find(siteArtifactId: string | Partial<AbstractModuleId>, debug?: boolean, localeId?: string): Artifact | undefined;
637
+ }
626
638
  export interface SiteMetadata {
627
639
  /**
628
640
  * Get the path that all site metadata is relative to
@@ -654,6 +666,14 @@ export interface SiteMetadata {
654
666
  * @returns
655
667
  */
656
668
  persistSiteMetadata(): Promise<void>;
669
+ /**
670
+ * Get get decision tree to figure out the best site bundle to use.
671
+ */
672
+ getSiteBundlesDecisionTree(): DecisionTree<SiteBundle>;
673
+ /**
674
+ * Get get decision tree to figure out the best site resource to use.
675
+ */
676
+ getSiteResourcesDecisionTree(): DecisionTree<SiteResource>;
657
677
  }
658
678
  export interface SiteBundles {
659
679
  bundles: Record<string, SiteBundle>;
@@ -667,6 +687,7 @@ export interface SiteAssets {
667
687
  export interface SiteArtifact {
668
688
  path: string;
669
689
  mimeType?: string;
690
+ integrity?: string;
670
691
  }
671
692
  export interface SiteResource extends SiteArtifact {
672
693
  inline?: boolean;
@@ -1,4 +1,4 @@
1
- import type { AssetProvider, HooksPlugin, ModuleProvider, ProviderContext, ResourceProvider, ViewProvider, ViewTransformPlugin } from './index';
1
+ import type { AssetProvider, HooksPlugin, ModuleProvider, ProviderContext, ResourceProvider, ViewProvider, ViewTransformPlugin } from './index.js';
2
2
  interface LwrShim {
3
3
  LWC_VERSION: string;
4
4
  LEGACY_LOADER: boolean;
@@ -1,5 +1,5 @@
1
1
  export type AppMetadata = {
2
- appId?: string;
2
+ appId?: string | null;
3
3
  bootstrapModule: string;
4
4
  rootComponent?: string;
5
5
  rootComponents?: string[];
@@ -1,4 +1,4 @@
1
- import type { ImportMetadata } from '../..';
1
+ import type { ImportMetadata } from '../../index.js';
2
2
  type ResolveParams = {
3
3
  parentUrl: string;
4
4
  };
@@ -1,16 +1,28 @@
1
- import type { ServerData } from '../index';
2
- import type { RegisterLoaderHooks } from './loaderPlugins/loaderPlugins';
3
- import type { RegisterHandleStaleModuleHook } from './handleStaleModule/handleStaleModule';
4
- import type { AppMetadata } from './appMetadata/appMetadata';
5
- export interface DataServiceAPI {
1
+ import type { ServerData } from '../index.js';
2
+ import type { RegisterLoaderHooks } from './loaderPlugins/loaderPlugins.js';
3
+ import type { RegisterHandleStaleModuleHook } from './handleStaleModule/handleStaleModule.js';
4
+ import type { AppMetadata } from './appMetadata/appMetadata.js';
5
+ export type ServerDataCallbackParams = {
6
6
  serverData: ServerData;
7
+ };
8
+ export interface ServerDataCallback {
9
+ (params: ServerDataCallbackParams): void | null;
7
10
  }
8
- export interface ServiceAPI extends DataServiceAPI {
11
+ interface RegisterServerDataCallback {
12
+ (hook: ServerDataCallback): void;
13
+ }
14
+ export interface ServiceAPI {
9
15
  addLoaderPlugin: NoOp | RegisterLoaderHooks;
10
16
  handleStaleModule: RegisterHandleStaleModuleHook;
17
+ addServerDataCallback: RegisterServerDataCallback;
11
18
  appMetadata: AppMetadata;
12
19
  }
20
+ export interface ServerServiceAPI {
21
+ addLoaderPlugin: NoOp | RegisterLoaderHooks;
22
+ addServerDataCallback: RegisterServerDataCallback;
23
+ }
13
24
  export interface NoOp {
14
25
  (): void;
15
26
  }
27
+ export {};
16
28
  //# sourceMappingURL=serviceAPI.d.ts.map
package/build/views.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface CompiledView extends ViewSource {
16
16
  properties?: {
17
17
  [key: string]: unknown;
18
18
  };
19
- render: (context?: any) => Promise<RenderingResult>;
19
+ render: (context: any, runtimeEnvironment: RuntimeEnvironment) => Promise<RenderingResult>;
20
20
  }
21
21
  export type NormalizedRenderingResult = Required<RenderingResult>;
22
22
  export interface RenderingResult {
@@ -74,6 +74,7 @@ export interface RenderedViewRecord {
74
74
  customElements?: CustomElementRecord[];
75
75
  endpoints?: Endpoints;
76
76
  importMetadata?: ImportMetadata;
77
+ moduleResources: ResourceDefinition[];
77
78
  bootstrapModule?: {
78
79
  specifier: Specifier;
79
80
  flatGraph: FlattenedModuleGraphs;
@@ -85,6 +86,7 @@ export interface LinkedViewDefinition {
85
86
  viewRecord: RenderedViewRecord;
86
87
  immutable: boolean;
87
88
  cache?: CacheResponse;
89
+ nonce?: string;
88
90
  }
89
91
  export interface ViewRequestQs {
90
92
  [key: string]: undefined | string | string[];
@@ -109,6 +111,7 @@ export interface ViewResponse {
109
111
  metadata?: {
110
112
  viewDefinition?: LinkedViewDefinition;
111
113
  };
114
+ locale?: string;
112
115
  }
113
116
  export type RouteHandlerViewResponse = ViewDefinitionResponse | ViewResponse;
114
117
  export interface ViewDefinitionResponse {
@@ -119,6 +122,7 @@ export interface ViewDefinitionResponse {
119
122
  cache?: CacheResponse;
120
123
  headers?: Record<string, string>;
121
124
  cookie?: 'wip';
125
+ locale?: string;
122
126
  }
123
127
  export interface ViewProvider {
124
128
  name: string;
@@ -175,11 +179,14 @@ export interface ViewPageContext {
175
179
  url: string;
176
180
  basePath?: string;
177
181
  locale?: string;
182
+ nonce?: string;
178
183
  }
179
184
  export type ViewModuleResourceContext = {
180
185
  isPreload?: boolean;
181
186
  isSSR?: boolean;
182
187
  async?: boolean;
188
+ nonce?: string;
189
+ integrity?: string;
183
190
  };
184
191
  export interface ViewRegistry {
185
192
  addViewProviders(providers: ViewProvider[]): void;
@@ -212,17 +219,28 @@ export interface SsrRequestOptions {
212
219
  host?: string;
213
220
  requestDepth?: number;
214
221
  }
222
+ export type MetaTag = {
223
+ name?: string;
224
+ httpEquiv?: string;
225
+ content?: string;
226
+ };
227
+ export type LinkTag = {
228
+ href: string;
229
+ as?: string;
230
+ rel?: string;
231
+ fetchpriority?: 'high' | 'low' | 'auto';
232
+ };
215
233
  export interface SsrDataResponse {
216
234
  props?: {
217
235
  [prop: string]: Json;
218
236
  };
219
237
  markup?: {
220
- links?: {
221
- href: string;
222
- as?: string;
223
- rel?: string;
224
- fetchpriority?: 'high' | 'low' | 'auto';
238
+ title?: string;
239
+ meta?: MetaTag[];
240
+ scripts?: {
241
+ body: string;
225
242
  }[];
243
+ links?: LinkTag[];
226
244
  };
227
245
  cache?: CacheResponse;
228
246
  }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "build": "tsc -b"
9
9
  },
10
10
  "type": "module",
11
- "version": "0.13.0-alpha.2",
11
+ "version": "0.13.0-alpha.21",
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": ">=18.0.0"
31
31
  },
32
- "gitHead": "3ae1051ef1eb282f9c1fb54f6aab44ab5ba48480"
32
+ "gitHead": "d272dcd07881fa469ee73bd28d2f30f99957e122"
33
33
  }