@lwrjs/view-registry 0.6.0-alpha.9 → 0.6.2

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.
@@ -156,14 +156,9 @@ var LwrViewRegistry = class {
156
156
  return false;
157
157
  }
158
158
  async getViewDefinition(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions) {
159
- const {id, bootstrap, rootComponent, contentTemplate, layoutTemplate} = view;
160
159
  const {skipCaching, freezeAssets, viewParamCacheKey} = (0, import_utils.normalizeRenderOptions)(this.runtimeEnvironment, renderOptions);
161
160
  const viewDefCacheKey = (0, import_shared_utils.getCacheKeyFromJson)({
162
- id,
163
- bootstrap,
164
- rootComponent,
165
- contentTemplate,
166
- layoutTemplate,
161
+ ...view,
167
162
  freezeAssets,
168
163
  locale: runtimeParams?.locale,
169
164
  debug: runtimeEnvironment.debug
@@ -180,13 +175,13 @@ var LwrViewRegistry = class {
180
175
  if (this.pendingViewDefinitions.has(pendingViewDefCacheKey)) {
181
176
  return this.pendingViewDefinitions.get(pendingViewDefCacheKey);
182
177
  }
183
- const pendingViewDefinition = this.renderView({id, bootstrap, rootComponent, contentTemplate, layoutTemplate}, viewParams, runtimeEnvironment, runtimeParams, renderOptions);
178
+ const pendingViewDefinition = this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions);
184
179
  this.pendingViewDefinitions.set(pendingViewDefCacheKey, pendingViewDefinition);
185
180
  const viewDefinition = await pendingViewDefinition;
186
181
  this.pendingViewDefinitions.delete(pendingViewDefCacheKey);
187
182
  if (cacheDisabled === false) {
188
183
  this.viewDefinitions.set(viewDefCacheKey, {
189
- view: {id, bootstrap, rootComponent, contentTemplate, layoutTemplate},
184
+ view,
190
185
  viewDefinition,
191
186
  paramKey: viewParamKey
192
187
  });
@@ -124,6 +124,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
124
124
  url: viewParams?.page?.url,
125
125
  configAsSrc: view.bootstrap?.configAsSrc || false
126
126
  }, {
127
+ appId: appIdentity.appName,
127
128
  bootstrapModule: versionedSpecifier,
128
129
  autoBoot: view.bootstrap?.autoBoot === false ? false : true,
129
130
  importMappings: {
@@ -57,7 +57,7 @@ function getViewBootstrapConfigurationResource(viewInfo, config, runtimeEnvironm
57
57
  ].filter(Boolean).join("\n");
58
58
  if (viewInfo.configAsSrc) {
59
59
  const viewUrl = viewInfo.url || "/";
60
- const url = (0, import_shared_utils.getClientBootstrapConfigurationUri)({id: viewInfo.id, url: viewUrl}, runtimeEnvironment, runtimeParams);
60
+ const url = (0, import_shared_utils.getClientBootstrapConfigurationUri)({id: viewInfo.id, url: viewUrl}, runtimeEnvironment, runtimeParams, (0, import_shared_utils.hashContent)(configString));
61
61
  return {
62
62
  type: CONTENT_TYPE,
63
63
  content: configString,
@@ -72,7 +72,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
72
72
  }, moduleRegistry, runtimeEnvironment, runtimeParams));
73
73
  }
74
74
  }
75
- const depth = isAMD ? {static: import_shared_utils.GraphDepth.ALL, dynamic: 1} : {static: import_shared_utils.GraphDepth.NONE, dynamic: 0};
75
+ const depth = isAMD ? {static: import_shared_utils.GraphDepth.ALL, dynamic: 1} : {static: import_shared_utils.GraphDepth.NONE, dynamic: 1};
76
76
  const bootstrapModuleGraph = await (0, import_shared_utils.getModuleGraphs)(bootstrapSpecifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams, visitedCache);
77
77
  const versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
78
78
  const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
@@ -126,6 +126,7 @@ async function getHtmlResources(view, viewParams, resourceContext) {
126
126
  url: viewParams?.page?.url,
127
127
  configAsSrc: view.bootstrap?.configAsSrc || false
128
128
  }, {
129
+ appId: appIdentity.appName,
129
130
  bootstrapModule: versionedSpecifier,
130
131
  autoBoot: view.bootstrap?.autoBoot === false ? false : true,
131
132
  imports: importMetadata?.imports,
package/build/es/index.js CHANGED
@@ -155,14 +155,9 @@ export class LwrViewRegistry {
155
155
  return false;
156
156
  }
157
157
  async getViewDefinition(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions) {
158
- const { id, bootstrap, rootComponent, contentTemplate, layoutTemplate } = view;
159
158
  const { skipCaching, freezeAssets, viewParamCacheKey } = normalizeRenderOptions(this.runtimeEnvironment, renderOptions);
160
159
  const viewDefCacheKey = getCacheKeyFromJson({
161
- id,
162
- bootstrap,
163
- rootComponent,
164
- contentTemplate,
165
- layoutTemplate,
160
+ ...view,
166
161
  freezeAssets,
167
162
  locale: runtimeParams?.locale,
168
163
  debug: runtimeEnvironment.debug,
@@ -187,13 +182,13 @@ export class LwrViewRegistry {
187
182
  if (this.pendingViewDefinitions.has(pendingViewDefCacheKey)) {
188
183
  return this.pendingViewDefinitions.get(pendingViewDefCacheKey);
189
184
  }
190
- const pendingViewDefinition = this.renderView({ id, bootstrap, rootComponent, contentTemplate, layoutTemplate }, viewParams, runtimeEnvironment, runtimeParams, renderOptions);
185
+ const pendingViewDefinition = this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions);
191
186
  this.pendingViewDefinitions.set(pendingViewDefCacheKey, pendingViewDefinition);
192
187
  const viewDefinition = await pendingViewDefinition;
193
188
  this.pendingViewDefinitions.delete(pendingViewDefCacheKey);
194
189
  if (cacheDisabled === false) {
195
190
  this.viewDefinitions.set(viewDefCacheKey, {
196
- view: { id, bootstrap, rootComponent, contentTemplate, layoutTemplate },
191
+ view,
197
192
  viewDefinition,
198
193
  paramKey: viewParamKey,
199
194
  });
@@ -134,6 +134,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
134
134
  url: viewParams?.page?.url,
135
135
  configAsSrc: view.bootstrap?.configAsSrc || false,
136
136
  }, {
137
+ appId: appIdentity.appName,
137
138
  bootstrapModule: versionedSpecifier,
138
139
  autoBoot: view.bootstrap?.autoBoot === false ? false : true,
139
140
  importMappings: {
@@ -1,4 +1,4 @@
1
- import { getMappingUriPrefix, getModuleUriPrefix, getClientBootstrapConfigurationUri, } from '@lwrjs/shared-utils';
1
+ import { getMappingUriPrefix, getModuleUriPrefix, getClientBootstrapConfigurationUri, hashContent, } from '@lwrjs/shared-utils';
2
2
  const CONTENT_TYPE = 'application/javascript';
3
3
  export function getViewBootstrapConfigurationResource(viewInfo, config, runtimeEnvironment, runtimeParams) {
4
4
  const { compat, debug, hmrEnabled, apiVersion, format } = runtimeEnvironment;
@@ -31,7 +31,7 @@ export function getViewBootstrapConfigurationResource(viewInfo, config, runtimeE
31
31
  .join('\n');
32
32
  if (viewInfo.configAsSrc) {
33
33
  const viewUrl = viewInfo.url || '/';
34
- const url = getClientBootstrapConfigurationUri({ id: viewInfo.id, url: viewUrl }, runtimeEnvironment, runtimeParams);
34
+ const url = getClientBootstrapConfigurationUri({ id: viewInfo.id, url: viewUrl }, runtimeEnvironment, runtimeParams, hashContent(configString));
35
35
  return {
36
36
  type: CONTENT_TYPE,
37
37
  content: configString,
@@ -63,10 +63,9 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
63
63
  // ------- Application Bootstrap module
64
64
  // Traversal of the Bootstrap Module Graph is done to get all the URLS for discoverable static dependencies.
65
65
  // Reasoning: This is to avoid unnecessary HTTP 302's during initial application module fetching.
66
- // Scope: ESM currently only exposes immutable URI references, optimize for AMD formats
67
66
  const depth = isAMD
68
67
  ? { static: GraphDepth.ALL, dynamic: 1 }
69
- : { static: GraphDepth.NONE, dynamic: 0 };
68
+ : { static: GraphDepth.NONE, dynamic: 1 };
70
69
  const bootstrapModuleGraph = await getModuleGraphs(bootstrapSpecifier, { includeUris: true, includeLinkedDefinitions: true, depth }, moduleRegistry, bundle ? moduleBundler : moduleRegistry, runtimeEnvironment, runtimeParams, visitedCache);
71
70
  // ADD bootstrap module uri as a script resource
72
71
  const versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
@@ -75,12 +74,12 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
75
74
  if (isAMD) {
76
75
  // ADD bootstrap module as required
77
76
  requiredAmdModules.push(versionedSpecifier);
78
- // AMD ADD bootstrap module uri addressability
77
+ // ADD bootstrap module uri addressability
79
78
  imports[versionedSpecifier] = uri;
80
79
  // PRELOAD bootstrap module static deps as link resource
81
80
  for (const staticDep of bootstrapModuleGraph.graphs[0].static) {
82
81
  const uri = bootstrapModuleGraph.uriMap[staticDep];
83
- // AMD ADD static module dep uri addressability
82
+ // ADD static module dep uri addressability
84
83
  imports[staticDep] = uri;
85
84
  // ADD bootstrap module static deps to requiredAmdModules if services, otherwise preloadModules
86
85
  if (services && services.length) {
@@ -89,7 +88,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
89
88
  requiredAmdModules.push(staticDep);
90
89
  }
91
90
  }
92
- // AMD Add import mappings for known dynamic imports
91
+ // Add import mappings for known dynamic imports
93
92
  for (const dynamicDep of bootstrapModuleGraph.graphs[0].dynamicRefs) {
94
93
  const uri = bootstrapModuleGraph.uriMap[dynamicDep];
95
94
  if (uri) {
@@ -136,6 +135,7 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
136
135
  url: viewParams?.page?.url,
137
136
  configAsSrc: view.bootstrap?.configAsSrc || false,
138
137
  }, {
138
+ appId: appIdentity.appName,
139
139
  bootstrapModule: versionedSpecifier,
140
140
  autoBoot: view.bootstrap?.autoBoot === false ? false : true,
141
141
  imports: importMetadata?.imports,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.6.0-alpha.9",
7
+ "version": "0.6.2",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,15 +30,15 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@lwrjs/app-service": "0.6.0-alpha.9",
34
- "@lwrjs/diagnostics": "0.6.0-alpha.9",
35
- "@lwrjs/shared-utils": "0.6.0-alpha.9"
33
+ "@lwrjs/app-service": "0.6.2",
34
+ "@lwrjs/diagnostics": "0.6.2",
35
+ "@lwrjs/shared-utils": "0.6.2"
36
36
  },
37
37
  "devDependencies": {
38
- "@lwrjs/types": "0.6.0-alpha.9"
38
+ "@lwrjs/types": "0.6.2"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=14.15.4 <17"
42
42
  },
43
- "gitHead": "9cb371a5d01ef345660138a48fe0b3f0119d0799"
43
+ "gitHead": "ef85bdc48adde58b7c648561d67acbb408bbe189"
44
44
  }