@lwrjs/view-registry 0.11.5 → 0.11.7

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.
@@ -101,11 +101,17 @@ async function getHtmlResources(view, viewParams, resourceContext) {
101
101
  throw Error("Failed to find definition of resource: " + shimBundle);
102
102
  }
103
103
  }
104
+ if (!def.inline && !def.src) {
105
+ throw Error(`Invalid Shim ${shimBundle}: ${JSON.stringify(def)}`);
106
+ }
104
107
  requiredResources.push(def);
105
108
  const errorShimDef = await resourceRegistry.getResource({specifier: "lwr-error-shim.js", version}, runtimeEnvironment, runtimeParams);
106
109
  if (!errorShimDef) {
107
110
  throw Error("Failed to find definition of resource: lwr-error-shim.js");
108
111
  }
112
+ if (!errorShimDef.inline && !errorShimDef.src) {
113
+ throw Error(`Invalid Shim lwr-error-shim.js: ${JSON.stringify(errorShimDef)}`);
114
+ }
109
115
  requiredResources.push(errorShimDef);
110
116
  }
111
117
  const bootstrapModuleGraph = await (0, import_shared_utils.getModuleGraphs)(bootstrapSpecifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visitedCache);
@@ -116,6 +122,9 @@ async function getHtmlResources(view, viewParams, resourceContext) {
116
122
  };
117
123
  versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
118
124
  const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
125
+ if (!uri) {
126
+ throw Error(`Invalid Module Resource ${versionedSpecifier}`);
127
+ }
119
128
  moduleResources.push((0, import_utils.getModuleResourceByUri)(uri, runtimeEnvironment, {isPreload: false, isSSR}));
120
129
  for (const depSpecifier of bootstrapModuleGraph.graphs[0].static) {
121
130
  if (!isExternal(depSpecifier)) {
@@ -30,6 +30,9 @@ __export(exports, {
30
30
  var import_diagnostics = __toModule(require("@lwrjs/diagnostics"));
31
31
  var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
32
32
  function setPreloadModulesMeta(specifier, uri, groups, preloads) {
33
+ if (!uri) {
34
+ throw Error(`Invalid Preload Module ${specifier}`);
35
+ }
33
36
  const [removedVersion, version] = specifier.split("/v/");
34
37
  const normalizedSpecifier = version === import_shared_utils.VERSION_NOT_PROVIDED ? removedVersion : specifier;
35
38
  specifier = normalizedSpecifier;
@@ -92,11 +92,17 @@ async function getHtmlResources(view, viewParams, resourceContext) {
92
92
  if (!def) {
93
93
  throw Error("Failed to find definition of resource: " + shimBundle);
94
94
  }
95
+ if (!def.inline && !def.src) {
96
+ throw Error(`Invalid Shim ${shimBundle}: ${JSON.stringify(def)}`);
97
+ }
95
98
  requiredResources.push(def);
96
99
  const errorShimDef = await resourceRegistry.getResource({specifier: "lwr-error-shim.js", version}, runtimeEnvironment, runtimeParams);
97
100
  if (!errorShimDef) {
98
101
  throw Error("Failed to find definition of resource: lwr-error-shim.js");
99
102
  }
103
+ if (!errorShimDef.inline && !errorShimDef.src) {
104
+ throw Error(`Invalid Shim lwr-error-shim.js: ${JSON.stringify(errorShimDef)}`);
105
+ }
100
106
  requiredResources.push(errorShimDef);
101
107
  }
102
108
  const bootstrapModuleGraph = await (0, import_shared_utils.getModuleGraphs)(bootstrapSpecifier, {includeUris: true, includeLinkedDefinitions: true, depth}, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visitedCache);
@@ -107,6 +113,9 @@ async function getHtmlResources(view, viewParams, resourceContext) {
107
113
  };
108
114
  versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
109
115
  const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
116
+ if (!uri) {
117
+ throw Error(`Invalid Module Resource ${versionedSpecifier}`);
118
+ }
110
119
  moduleResources.push((0, import_utils.getModuleResourceByUri)(uri, runtimeEnvironment, {isPreload: false, isSSR}));
111
120
  for (const depSpecifier of bootstrapModuleGraph.graphs[0].static) {
112
121
  if (!isExternal(depSpecifier)) {
@@ -94,12 +94,20 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
94
94
  throw Error('Failed to find definition of resource: ' + shimBundle);
95
95
  }
96
96
  }
97
+ // Throw a very specific error if we get this back and the src or inline properties are not set
98
+ if (!def.inline && !def.src) {
99
+ throw Error(`Invalid Shim ${shimBundle}: ${JSON.stringify(def)}`);
100
+ }
97
101
  requiredResources.push(def);
98
102
  // Always inline the error shim script after the shim
99
103
  const errorShimDef = (await resourceRegistry.getResource({ specifier: 'lwr-error-shim.js', version }, runtimeEnvironment, runtimeParams));
100
104
  if (!errorShimDef) {
101
105
  throw Error('Failed to find definition of resource: lwr-error-shim.js');
102
106
  }
107
+ // Throw a very specific error if we get this back and the src or inline properties are not set
108
+ if (!errorShimDef.inline && !errorShimDef.src) {
109
+ throw Error(`Invalid Shim lwr-error-shim.js: ${JSON.stringify(errorShimDef)}`);
110
+ }
103
111
  requiredResources.push(errorShimDef);
104
112
  }
105
113
  // ------- Application Bootstrap module
@@ -115,6 +123,10 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
115
123
  // ADD bootstrap module uri as a script resource
116
124
  versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
117
125
  const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
126
+ // Throw a very specific error if we get this back and the uri property is not set
127
+ if (!uri) {
128
+ throw Error(`Invalid Module Resource ${versionedSpecifier}`);
129
+ }
118
130
  moduleResources.push(getModuleResourceByUri(uri, runtimeEnvironment, { isPreload: false, isSSR }));
119
131
  // PRELOAD the bootstrap module static dependencies as preloaded script resources
120
132
  for (const depSpecifier of bootstrapModuleGraph.graphs[0].static) {
@@ -4,6 +4,10 @@ import { explodeSpecifier, getGroupName, getVersionedModuleId, normalizeVersionT
4
4
  * keeps track of preloadModules metadata
5
5
  */
6
6
  export function setPreloadModulesMeta(specifier, uri, groups, preloads) {
7
+ // Throw a very specific error if we get this back and the uri property is not set
8
+ if (!uri) {
9
+ throw Error(`Invalid Preload Module ${specifier}`);
10
+ }
7
11
  // We need to support version-less preloadModules, including version-less rootComponents.
8
12
  // Removing the "/v/version_not_provided" hack from the preloadModules specifier
9
13
  // because otherwise the loader will wait for that module that will never get defined.
@@ -79,12 +79,20 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
79
79
  if (!def) {
80
80
  throw Error('Failed to find definition of resource: ' + shimBundle);
81
81
  }
82
+ // Throw a very specific error if we get this back and the src or inline properties are not set
83
+ if (!def.inline && !def.src) {
84
+ throw Error(`Invalid Shim ${shimBundle}: ${JSON.stringify(def)}`);
85
+ }
82
86
  requiredResources.push(def);
83
87
  // Always inline the error shim script after the shim
84
88
  const errorShimDef = (await resourceRegistry.getResource({ specifier: 'lwr-error-shim.js', version }, runtimeEnvironment, runtimeParams));
85
89
  if (!errorShimDef) {
86
90
  throw Error('Failed to find definition of resource: lwr-error-shim.js');
87
91
  }
92
+ // Throw a very specific error if we get this back and the src or inline properties are not set
93
+ if (!errorShimDef.inline && !errorShimDef.src) {
94
+ throw Error(`Invalid Shim lwr-error-shim.js: ${JSON.stringify(errorShimDef)}`);
95
+ }
88
96
  requiredResources.push(errorShimDef);
89
97
  }
90
98
  // ------- Application Bootstrap module
@@ -99,6 +107,10 @@ export async function getHtmlResources(view, viewParams, resourceContext) {
99
107
  // ADD bootstrap module uri as a script resource
100
108
  versionedSpecifier = bootstrapModuleGraph.graphs[0].specifier;
101
109
  const uri = bootstrapModuleGraph.uriMap[versionedSpecifier];
110
+ // Throw a very specific error if we get this back and the uri property is not set
111
+ if (!uri) {
112
+ throw Error(`Invalid Module Resource ${versionedSpecifier}`);
113
+ }
102
114
  moduleResources.push(getModuleResourceByUri(uri, runtimeEnvironment, { isPreload: false, isSSR }));
103
115
  // PRELOAD the bootstrap module static dependencies as preloaded script resources
104
116
  for (const depSpecifier of bootstrapModuleGraph.graphs[0].static) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.11.5",
7
+ "version": "0.11.7",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,17 +30,17 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@lwrjs/app-service": "0.11.5",
34
- "@lwrjs/diagnostics": "0.11.5",
35
- "@lwrjs/instrumentation": "0.11.5",
36
- "@lwrjs/shared-utils": "0.11.5",
33
+ "@lwrjs/app-service": "0.11.7",
34
+ "@lwrjs/diagnostics": "0.11.7",
35
+ "@lwrjs/instrumentation": "0.11.7",
36
+ "@lwrjs/shared-utils": "0.11.7",
37
37
  "lru-cache": "^10.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@lwrjs/types": "0.11.5"
40
+ "@lwrjs/types": "0.11.7"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=16.0.0"
44
44
  },
45
- "gitHead": "b1a54889dd55baed1bf61ceb497d251958415595"
45
+ "gitHead": "40a0b8c0a1b8542489eb56e032dde0b2150793db"
46
46
  }