@lwrjs/shared-utils 0.15.0-alpha.23 → 0.15.0-alpha.25

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.
@@ -118,9 +118,17 @@ async function getModuleGraphs(specifier, options, moduleRegistry, defRegistry,
118
118
  }
119
119
  const flattened = [];
120
120
  await traverse(moduleDef, depth, flattened, 0, acc, defRegistry, runtimeEnvironment, runtimeParams);
121
+ let extraFlat = new Set();
122
+ if (options.includeUris || options.includeLinkedDefinitions) {
123
+ const allDeps = flattened.reduce((all, node) => {
124
+ all.push(node.specifier, ...node.static, ...node.dynamicRefs);
125
+ return all;
126
+ }, []).filter((dep) => acc.has(dep));
127
+ extraFlat = new Set(allDeps);
128
+ }
121
129
  const uriMap = {};
122
130
  if (options.includeUris) {
123
- for (const visitedSpecifier of acc.keys()) {
131
+ for (const visitedSpecifier of extraFlat.keys()) {
124
132
  const moduleId = await (0, import_identity.getVersionedModuleId)(visitedSpecifier, moduleRegistry, runtimeParams);
125
133
  const uri = await defRegistry.resolveModuleUri(moduleId, runtimeEnvironment, runtimeParams);
126
134
  uriMap[visitedSpecifier] = uri;
@@ -128,7 +136,7 @@ async function getModuleGraphs(specifier, options, moduleRegistry, defRegistry,
128
136
  }
129
137
  const linkedDefinitions = {};
130
138
  if (options.includeLinkedDefinitions) {
131
- for (const visitedSpecifier of acc.keys()) {
139
+ for (const visitedSpecifier of extraFlat.keys()) {
132
140
  const versionedModuleId2 = await (0, import_identity.getVersionedModuleId)(visitedSpecifier, moduleRegistry, runtimeParams);
133
141
  const module2 = isBundler(defRegistry) ? await defRegistry.getModuleBundle(versionedModuleId2, runtimeEnvironment, runtimeParams) : await defRegistry.getLinkedModule(versionedModuleId2, runtimeEnvironment, runtimeParams);
134
142
  linkedDefinitions[visitedSpecifier] = module2;
package/build/es/graph.js CHANGED
@@ -123,9 +123,22 @@ options, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visited
123
123
  }
124
124
  const flattened = [];
125
125
  await traverse(moduleDef, depth, flattened, 0, acc, defRegistry, runtimeEnvironment, runtimeParams);
126
+ let extraFlat = new Set();
127
+ if (options.includeUris || options.includeLinkedDefinitions) {
128
+ // Get a set of the root specifier and all dependencies
129
+ // DO NOT use the visited map for including URIs and linked defs because it includes
130
+ // entries from previous runs of getModuleGraphs() which belong to OTHER root specifiers
131
+ const allDeps = flattened
132
+ .reduce((all, node) => {
133
+ all.push(node.specifier, ...node.static, ...node.dynamicRefs);
134
+ return all;
135
+ }, [])
136
+ .filter((dep) => acc.has(dep));
137
+ extraFlat = new Set(allDeps);
138
+ }
126
139
  const uriMap = {};
127
140
  if (options.includeUris) {
128
- for (const visitedSpecifier of acc.keys()) {
141
+ for (const visitedSpecifier of extraFlat.keys()) {
129
142
  // eslint-disable-next-line no-await-in-loop
130
143
  const moduleId = await getVersionedModuleId(visitedSpecifier, moduleRegistry, runtimeParams);
131
144
  // eslint-disable-next-line no-await-in-loop
@@ -135,7 +148,7 @@ options, moduleRegistry, defRegistry, runtimeEnvironment, runtimeParams, visited
135
148
  }
136
149
  const linkedDefinitions = {};
137
150
  if (options.includeLinkedDefinitions) {
138
- for (const visitedSpecifier of acc.keys()) {
151
+ for (const visitedSpecifier of extraFlat.keys()) {
139
152
  // eslint-disable-next-line no-await-in-loop
140
153
  const versionedModuleId = await getVersionedModuleId(visitedSpecifier, moduleRegistry, runtimeParams);
141
154
  const module = isBundler(defRegistry)
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.23",
7
+ "version": "0.15.0-alpha.25",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "build/**/*.d.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@lwrjs/diagnostics": "0.15.0-alpha.23",
40
+ "@lwrjs/diagnostics": "0.15.0-alpha.25",
41
41
  "es-module-lexer": "^1.5.4",
42
42
  "fast-json-stable-stringify": "^2.1.0",
43
43
  "magic-string": "^0.30.9",
@@ -50,13 +50,13 @@
50
50
  "slugify": "^1.4.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@lwrjs/types": "0.15.0-alpha.23",
53
+ "@lwrjs/types": "0.15.0-alpha.25",
54
54
  "@types/mime-types": "2.1.4",
55
55
  "@types/path-to-regexp": "^1.7.0",
56
- "memfs": "^4.9.3"
56
+ "memfs": "^4.13.0"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=18.0.0"
60
60
  },
61
- "gitHead": "07592ebcbcfd739a9a8882b2f8f56da50332250d"
61
+ "gitHead": "0e430bd7cbd44f66c9a30d86d2dc69fa592af0ea"
62
62
  }