@cdxgen/cdxgen 13.5.0 → 13.6.0
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/README.md +6 -6
- package/bin/cdxgen.js +4 -0
- package/bin/evinse.js +3 -0
- package/bin/validate.js +6 -0
- package/data/license-aliases.json +24 -2
- package/data/remediations.json +124 -0
- package/data/rules/ai-bom.yaml +1 -1
- package/data/rules/brotli-decoder.yaml +107 -0
- package/data/rules/vscode-extensions.yaml +75 -0
- package/data/spdx-license-list.json +121 -7
- package/data/spdx-licenses.json +69 -0
- package/data/spdx.schema.json +845 -2
- package/lib/cli/bomAssembly.js +92 -3
- package/lib/cli/index.js +108 -1
- package/lib/cli/jsBom.js +153 -64
- package/lib/cli/jvmBom.js +237 -46
- package/lib/cli/managedBom.js +142 -16
- package/lib/cli/nativeBom.js +42 -5
- package/lib/core/boundedFile.js +344 -0
- package/lib/core/brotliProbe.js +182 -0
- package/lib/core/env.js +8 -0
- package/lib/core/fs.js +12 -0
- package/lib/core/httpClient.js +98 -1
- package/lib/core/lockPaths.js +38 -0
- package/lib/core/paths.js +24 -1
- package/lib/core/processTree.js +5 -0
- package/lib/core/toolRegistry.js +170 -0
- package/lib/ecosystems/cppEvidence.js +263 -106
- package/lib/ecosystems/cppIncludeResolver.js +16 -5
- package/lib/ecosystems/ecosystems.js +25 -10
- package/lib/ecosystems/gemHostProbe.js +301 -0
- package/lib/ecosystems/gradleutils.js +828 -224
- package/lib/ecosystems/parsers-bazel.js +107 -6
- package/lib/ecosystems/parsers-js.js +505 -22
- package/lib/ecosystems/parsers-misc.js +209 -20
- package/lib/ecosystems/parsers-python.js +89 -2
- package/lib/ecosystems/pythonutils.js +128 -2
- package/lib/ecosystems/rubyutils.js +538 -31
- package/lib/ecosystems/scalacliutils.js +2 -0
- package/lib/ecosystems/scalasem.js +796 -151
- package/lib/ecosystems/vendoredCode.js +237 -3
- package/lib/ecosystems/venvProbe.js +360 -0
- package/lib/evinser/evinser.js +346 -43
- package/lib/helpers/agenticToolutils.js +413 -93
- package/lib/helpers/vsixutils.js +1574 -315
- package/lib/inventory/atomUtils.js +77 -0
- package/lib/inventory/brotliDecoder.js +142 -0
- package/lib/inventory/buildToolRateLimit.js +1 -1
- package/lib/inventory/cbomutils.js +56 -7
- package/lib/inventory/deps.js +35 -0
- package/lib/inventory/dosai.js +139 -5
- package/lib/inventory/dotnetRuntime.js +217 -0
- package/lib/inventory/envcontext.js +307 -13
- package/lib/inventory/evidenceUtils.js +11 -0
- package/lib/inventory/fetchBatch.js +1 -1
- package/lib/inventory/formulationParsers.js +31 -3
- package/lib/inventory/gtfobins.js +13 -0
- package/lib/inventory/hostRuntimeProbe.js +686 -0
- package/lib/inventory/jvmLocalRepos.js +9 -2
- package/lib/inventory/jvmToolEnv.js +29 -0
- package/lib/inventory/licenseEnhancer.js +12 -0
- package/lib/inventory/mavenCentralMirror.js +534 -0
- package/lib/inventory/nodeBuildInfo.js +218 -0
- package/lib/inventory/nodeHostProbe.js +202 -0
- package/lib/inventory/osPackageResolver.js +182 -0
- package/lib/inventory/phpBuildInfo.js +10 -59
- package/lib/inventory/phpHostProbe.js +32 -488
- package/lib/inventory/rubyBuildInfo.js +972 -0
- package/lib/inventory/rubyHostProbe.js +218 -0
- package/lib/inventory/scalaCoords.js +4 -3
- package/lib/inventory/scalaDedupe.js +440 -0
- package/lib/inventory/source.js +49 -2
- package/lib/managers/binary.js +337 -3
- package/lib/managers/docker.js +79 -0
- package/lib/parsers/largeJson.js +28 -11
- package/lib/parsers/vscodeExtensionId.js +183 -0
- package/lib/server/server.js +12 -1
- package/lib/stages/postgen/ruleEngine.js +13 -5
- package/lib/stages/pregen/envAudit.js +1 -0
- package/lib/stages/pregen/pregen.js +114 -57
- package/lib/validator/bomValidator.js +6 -1
- package/lib/validator/generated/validate-1.6.mjs +1 -1
- package/lib/validator/generated/validate-1.7.mjs +1 -1
- package/lib/validator/generated/validate-2.0.mjs +1 -1
- package/lib/validator/index.js +1 -1
- package/package.json +3 -2
- package/types/lib/cli/bomAssembly.d.ts +13 -1
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts +1 -17
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/boundedFile.d.ts +70 -0
- package/types/lib/core/boundedFile.d.ts.map +1 -0
- package/types/lib/core/brotliProbe.d.ts +37 -0
- package/types/lib/core/brotliProbe.d.ts.map +1 -0
- package/types/lib/core/env.d.ts +4 -0
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/httpClient.d.ts +24 -0
- package/types/lib/core/httpClient.d.ts.map +1 -1
- package/types/lib/core/lockPaths.d.ts +19 -0
- package/types/lib/core/lockPaths.d.ts.map +1 -0
- package/types/lib/core/processTree.d.ts +2 -0
- package/types/lib/core/processTree.d.ts.map +1 -1
- package/types/lib/core/toolRegistry.d.ts +36 -0
- package/types/lib/core/toolRegistry.d.ts.map +1 -0
- package/types/lib/ecosystems/cppEvidence.d.ts +40 -13
- package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts +2 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/gemHostProbe.d.ts +28 -0
- package/types/lib/ecosystems/gemHostProbe.d.ts.map +1 -0
- package/types/lib/ecosystems/gradleutils.d.ts +47 -13
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-bazel.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-js.d.ts +17 -20
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts +19 -0
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts +10 -0
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +20 -2
- package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts +144 -12
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -1
- package/types/lib/ecosystems/vendoredCode.d.ts +26 -0
- package/types/lib/ecosystems/vendoredCode.d.ts.map +1 -1
- package/types/lib/ecosystems/venvProbe.d.ts +40 -0
- package/types/lib/ecosystems/venvProbe.d.ts.map +1 -0
- package/types/lib/evinser/evinser.d.ts +63 -8
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/inventory/atomUtils.d.ts +19 -0
- package/types/lib/inventory/atomUtils.d.ts.map +1 -1
- package/types/lib/inventory/brotliDecoder.d.ts +58 -0
- package/types/lib/inventory/brotliDecoder.d.ts.map +1 -0
- package/types/lib/inventory/cbomutils.d.ts +17 -0
- package/types/lib/inventory/cbomutils.d.ts.map +1 -1
- package/types/lib/inventory/deps.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +17 -1
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dotnetRuntime.d.ts +44 -0
- package/types/lib/inventory/dotnetRuntime.d.ts.map +1 -0
- package/types/lib/inventory/envcontext.d.ts +52 -6
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
- package/types/lib/inventory/gtfobins.d.ts.map +1 -1
- package/types/lib/inventory/hostRuntimeProbe.d.ts +44 -0
- package/types/lib/inventory/hostRuntimeProbe.d.ts.map +1 -0
- package/types/lib/inventory/jvmToolEnv.d.ts +12 -0
- package/types/lib/inventory/jvmToolEnv.d.ts.map +1 -1
- package/types/lib/inventory/licenseEnhancer.d.ts.map +1 -1
- package/types/lib/inventory/mavenCentralMirror.d.ts +170 -0
- package/types/lib/inventory/mavenCentralMirror.d.ts.map +1 -0
- package/types/lib/inventory/nodeBuildInfo.d.ts +95 -0
- package/types/lib/inventory/nodeBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/nodeHostProbe.d.ts +15 -0
- package/types/lib/inventory/nodeHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/osPackageResolver.d.ts +38 -0
- package/types/lib/inventory/osPackageResolver.d.ts.map +1 -1
- package/types/lib/inventory/phpBuildInfo.d.ts.map +1 -1
- package/types/lib/inventory/phpHostProbe.d.ts.map +1 -1
- package/types/lib/inventory/rubyBuildInfo.d.ts +271 -0
- package/types/lib/inventory/rubyBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/rubyHostProbe.d.ts +47 -0
- package/types/lib/inventory/rubyHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/source.d.ts +10 -0
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts +12 -0
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/parsers/largeJson.d.ts +4 -3
- package/types/lib/parsers/largeJson.d.ts.map +1 -1
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/lib/stages/pregen/envAudit.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +12 -8
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
package/lib/cli/jsBom.js
CHANGED
|
@@ -70,9 +70,13 @@ import {
|
|
|
70
70
|
} from "../helpers/agenticToolutils.js";
|
|
71
71
|
import {
|
|
72
72
|
cleanupTempDir,
|
|
73
|
-
|
|
73
|
+
collectIdeInventory,
|
|
74
74
|
discoverIdeExtensionDirs,
|
|
75
75
|
extractVsixToTempDir,
|
|
76
|
+
identifyIdeFromExtensionsDir,
|
|
77
|
+
isInstalledExtensionDir,
|
|
78
|
+
isInstalledExtensionsDir,
|
|
79
|
+
mergeExtensionComponents,
|
|
76
80
|
parseVsixFile,
|
|
77
81
|
VSCODE_EXTENSION_PURL_TYPE,
|
|
78
82
|
} from "../helpers/vsixutils.js";
|
|
@@ -96,6 +100,7 @@ import {
|
|
|
96
100
|
} from "../inventory/depsUtils.js";
|
|
97
101
|
import { GIT_COMMAND } from "../inventory/envcontext.js";
|
|
98
102
|
import { tryBuildPurl } from "../inventory/purl.js";
|
|
103
|
+
import { isInsideInstalledGem } from "../inventory/rubyBuildInfo.js";
|
|
99
104
|
import { DEFAULT_NPMRC_BLOCKLIST, parseNpmrc } from "../parsers/npmrc.js";
|
|
100
105
|
import {
|
|
101
106
|
buildBomNSData,
|
|
@@ -127,6 +132,13 @@ const isWin = _platform() === "win32";
|
|
|
127
132
|
* @param {object} options CLI options
|
|
128
133
|
* @returns {string|undefined} The detected AI inventory type (`"ai"`) or undefined
|
|
129
134
|
*/
|
|
135
|
+
// The manifests and lockfiles inside an installed gem, such as the VS Code
|
|
136
|
+
// extension typeprof ships, are part of the gem's sources and install nothing.
|
|
137
|
+
// An image scan reads each gem home as a directory of its own, so the check is
|
|
138
|
+
// on the absolute path rather than a glob relative to the scanned directory.
|
|
139
|
+
const outsideInstalledGems = (files, scanRoot) =>
|
|
140
|
+
files.filter((file) => !isInsideInstalledGem(file, safeExistsSync, scanRoot));
|
|
141
|
+
|
|
130
142
|
export function getDirectAiInventoryType(path, options) {
|
|
131
143
|
const exactAiInventoryType = getExactAiInventoryType(options);
|
|
132
144
|
if (exactAiInventoryType) {
|
|
@@ -166,6 +178,9 @@ export async function createNodejsBom(path, options) {
|
|
|
166
178
|
let dependencies = [];
|
|
167
179
|
let parentComponent = {};
|
|
168
180
|
const parentSubComponents = [];
|
|
181
|
+
// Formulation components reported by the pnpm lockfiles, such as the
|
|
182
|
+
// pnpm version resolved for the project.
|
|
183
|
+
const pnpmFormulationList = [];
|
|
169
184
|
let ppurl = "";
|
|
170
185
|
const exactAiInventoryType = getDirectAiInventoryType(path, options);
|
|
171
186
|
const requestedAiInventoryTypes = getRequestedAiInventoryTypes(options);
|
|
@@ -225,7 +240,10 @@ export async function createNodejsBom(path, options) {
|
|
|
225
240
|
}
|
|
226
241
|
// Docker mode requires special handling
|
|
227
242
|
if (hasAnyProjectType(["docker", "oci", "container", "os"], options, false)) {
|
|
228
|
-
const pkgJsonFiles =
|
|
243
|
+
const pkgJsonFiles = outsideInstalledGems(
|
|
244
|
+
getAllFiles(path, "**/package.json", options),
|
|
245
|
+
path,
|
|
246
|
+
);
|
|
229
247
|
// Are there any package.json files in the container?
|
|
230
248
|
if (pkgJsonFiles.length) {
|
|
231
249
|
// Every manifest is read locally first, and the registry is asked about
|
|
@@ -314,33 +332,48 @@ export async function createNodejsBom(path, options) {
|
|
|
314
332
|
// otherwise the dependencies of those nested projects are silently dropped
|
|
315
333
|
// from the BOM (see #4224). node_modules and .git stay ignored by getAllFiles.
|
|
316
334
|
const lockSearchOptions = { ...options, includeDot: true };
|
|
317
|
-
let yarnLockFiles =
|
|
335
|
+
let yarnLockFiles = outsideInstalledGems(
|
|
336
|
+
getAllFiles(
|
|
337
|
+
path,
|
|
338
|
+
`${options.multiProject ? "**/" : ""}yarn.lock`,
|
|
339
|
+
lockSearchOptions,
|
|
340
|
+
),
|
|
318
341
|
path,
|
|
319
|
-
`${options.multiProject ? "**/" : ""}yarn.lock`,
|
|
320
|
-
lockSearchOptions,
|
|
321
342
|
);
|
|
322
|
-
const shrinkwrapFiles =
|
|
343
|
+
const shrinkwrapFiles = outsideInstalledGems(
|
|
344
|
+
getAllFiles(
|
|
345
|
+
path,
|
|
346
|
+
`${options.multiProject ? "**/" : ""}npm-shrinkwrap.json`,
|
|
347
|
+
lockSearchOptions,
|
|
348
|
+
),
|
|
323
349
|
path,
|
|
324
|
-
`${options.multiProject ? "**/" : ""}npm-shrinkwrap.json`,
|
|
325
|
-
lockSearchOptions,
|
|
326
350
|
);
|
|
327
|
-
let pkgLockFiles =
|
|
351
|
+
let pkgLockFiles = outsideInstalledGems(
|
|
352
|
+
getAllFiles(
|
|
353
|
+
path,
|
|
354
|
+
`${options.multiProject ? "**/" : ""}package-lock.json`,
|
|
355
|
+
lockSearchOptions,
|
|
356
|
+
),
|
|
328
357
|
path,
|
|
329
|
-
`${options.multiProject ? "**/" : ""}package-lock.json`,
|
|
330
|
-
lockSearchOptions,
|
|
331
358
|
);
|
|
332
359
|
if (shrinkwrapFiles.length) {
|
|
333
360
|
pkgLockFiles = pkgLockFiles.concat(shrinkwrapFiles);
|
|
334
361
|
}
|
|
335
|
-
let pnpmLockFiles =
|
|
362
|
+
let pnpmLockFiles = outsideInstalledGems(
|
|
363
|
+
getAllFiles(
|
|
364
|
+
path,
|
|
365
|
+
`${options.multiProject ? "**/" : ""}pnpm-lock.yaml`,
|
|
366
|
+
lockSearchOptions,
|
|
367
|
+
),
|
|
336
368
|
path,
|
|
337
|
-
`${options.multiProject ? "**/" : ""}pnpm-lock.yaml`,
|
|
338
|
-
lockSearchOptions,
|
|
339
369
|
);
|
|
340
|
-
const bunLockFiles =
|
|
370
|
+
const bunLockFiles = outsideInstalledGems(
|
|
371
|
+
getAllFiles(
|
|
372
|
+
path,
|
|
373
|
+
`${options.multiProject ? "**/" : ""}bun.lock`,
|
|
374
|
+
lockSearchOptions,
|
|
375
|
+
),
|
|
341
376
|
path,
|
|
342
|
-
`${options.multiProject ? "**/" : ""}bun.lock`,
|
|
343
|
-
lockSearchOptions,
|
|
344
377
|
);
|
|
345
378
|
// Warn about the binary bun lockfile which cdxgen cannot parse. Users should
|
|
346
379
|
// regenerate a text lockfile with `bun install --save-text-lockfile`.
|
|
@@ -476,15 +509,21 @@ export async function createNodejsBom(path, options) {
|
|
|
476
509
|
}
|
|
477
510
|
}
|
|
478
511
|
}
|
|
479
|
-
const pkgJsonLockFiles =
|
|
512
|
+
const pkgJsonLockFiles = outsideInstalledGems(
|
|
513
|
+
getAllFiles(
|
|
514
|
+
path,
|
|
515
|
+
`${options.multiProject ? "**/" : ""}package-lock.json`,
|
|
516
|
+
lockSearchOptions,
|
|
517
|
+
),
|
|
480
518
|
path,
|
|
481
|
-
`${options.multiProject ? "**/" : ""}package-lock.json`,
|
|
482
|
-
lockSearchOptions,
|
|
483
519
|
);
|
|
484
|
-
const pkgJsonFiles =
|
|
520
|
+
const pkgJsonFiles = outsideInstalledGems(
|
|
521
|
+
getAllFiles(
|
|
522
|
+
path,
|
|
523
|
+
`${options.multiProject ? "**/" : ""}package.json`,
|
|
524
|
+
lockSearchOptions,
|
|
525
|
+
),
|
|
485
526
|
path,
|
|
486
|
-
`${options.multiProject ? "**/" : ""}package.json`,
|
|
487
|
-
lockSearchOptions,
|
|
488
527
|
);
|
|
489
528
|
const npmInstallCount =
|
|
490
529
|
Number.parseInt(readEnvironmentVariable("NPM_INSTALL_COUNT"), 10) || 2;
|
|
@@ -708,20 +747,29 @@ export async function createNodejsBom(path, options) {
|
|
|
708
747
|
anyInstallSuccess = true;
|
|
709
748
|
}
|
|
710
749
|
}
|
|
711
|
-
pkgLockFiles =
|
|
750
|
+
pkgLockFiles = outsideInstalledGems(
|
|
751
|
+
getAllFiles(
|
|
752
|
+
path,
|
|
753
|
+
`${options.multiProject ? "**/" : ""}package-lock.json`,
|
|
754
|
+
options,
|
|
755
|
+
),
|
|
712
756
|
path,
|
|
713
|
-
`${options.multiProject ? "**/" : ""}package-lock.json`,
|
|
714
|
-
options,
|
|
715
757
|
);
|
|
716
|
-
pnpmLockFiles =
|
|
758
|
+
pnpmLockFiles = outsideInstalledGems(
|
|
759
|
+
getAllFiles(
|
|
760
|
+
path,
|
|
761
|
+
`${options.multiProject ? "**/" : ""}pnpm-lock.yaml`,
|
|
762
|
+
options,
|
|
763
|
+
),
|
|
717
764
|
path,
|
|
718
|
-
`${options.multiProject ? "**/" : ""}pnpm-lock.yaml`,
|
|
719
|
-
options,
|
|
720
765
|
);
|
|
721
|
-
yarnLockFiles =
|
|
766
|
+
yarnLockFiles = outsideInstalledGems(
|
|
767
|
+
getAllFiles(
|
|
768
|
+
path,
|
|
769
|
+
`${options.multiProject ? "**/" : ""}yarn.lock`,
|
|
770
|
+
options,
|
|
771
|
+
),
|
|
722
772
|
path,
|
|
723
|
-
`${options.multiProject ? "**/" : ""}yarn.lock`,
|
|
724
|
-
options,
|
|
725
773
|
);
|
|
726
774
|
if (
|
|
727
775
|
anyInstallSuccess &&
|
|
@@ -743,7 +791,6 @@ export async function createNodejsBom(path, options) {
|
|
|
743
791
|
const workspaceSrcFiles = {};
|
|
744
792
|
const workspaceDirectDeps = {};
|
|
745
793
|
const depsWorkspaceRefs = {};
|
|
746
|
-
let workspaceCatalogs = {};
|
|
747
794
|
const seenPkgJsonFiles = {};
|
|
748
795
|
// Is this a pnpm workspace?
|
|
749
796
|
for (const f of pnpmWorkspaceFiles) {
|
|
@@ -832,10 +879,6 @@ export async function createNodejsBom(path, options) {
|
|
|
832
879
|
}
|
|
833
880
|
}
|
|
834
881
|
}
|
|
835
|
-
workspaceCatalogs = {
|
|
836
|
-
...workspaceCatalogs,
|
|
837
|
-
...(workspaceObj.catalogs || {}),
|
|
838
|
-
};
|
|
839
882
|
}
|
|
840
883
|
if (DEBUG_MODE && Object.keys(seenPkgJsonFiles).length) {
|
|
841
884
|
console.log(
|
|
@@ -898,11 +941,13 @@ export async function createNodejsBom(path, options) {
|
|
|
898
941
|
parentComponent,
|
|
899
942
|
workspacePackages,
|
|
900
943
|
workspaceSrcFiles,
|
|
901
|
-
workspaceCatalogs,
|
|
902
944
|
workspaceDirectDeps,
|
|
903
945
|
depsWorkspaceRefs,
|
|
904
946
|
path,
|
|
905
947
|
);
|
|
948
|
+
if (parsedList?.formulationList?.length) {
|
|
949
|
+
pnpmFormulationList.push(...parsedList.formulationList);
|
|
950
|
+
}
|
|
906
951
|
const dlist = parsedList.pkgList;
|
|
907
952
|
if (dlist?.length) {
|
|
908
953
|
pkgList = pkgList.concat(dlist);
|
|
@@ -1043,7 +1088,6 @@ export async function createNodejsBom(path, options) {
|
|
|
1043
1088
|
{},
|
|
1044
1089
|
{},
|
|
1045
1090
|
{},
|
|
1046
|
-
{},
|
|
1047
1091
|
path,
|
|
1048
1092
|
);
|
|
1049
1093
|
let pkgList = addWasmComponentsFromImports(
|
|
@@ -1554,6 +1598,7 @@ export async function createNodejsBom(path, options) {
|
|
|
1554
1598
|
dependencies,
|
|
1555
1599
|
parentComponent,
|
|
1556
1600
|
services: inventoryServices,
|
|
1601
|
+
formulationList: pnpmFormulationList,
|
|
1557
1602
|
});
|
|
1558
1603
|
}
|
|
1559
1604
|
|
|
@@ -1724,12 +1769,13 @@ export async function createVscodeExtensionBom(path, options) {
|
|
|
1724
1769
|
// Mode 1: Scan for .vsix files in the given directory, or treat the input
|
|
1725
1770
|
// path as a single .vsix file.
|
|
1726
1771
|
let vsixFiles = [];
|
|
1727
|
-
|
|
1772
|
+
const isVsixPath = path.toLowerCase().endsWith(".vsix");
|
|
1773
|
+
if (isVsixPath) {
|
|
1728
1774
|
vsixFiles = [resolve(path)];
|
|
1729
1775
|
} else {
|
|
1730
1776
|
vsixFiles = getAllFiles(
|
|
1731
1777
|
path,
|
|
1732
|
-
`${options.multiProject ? "**/" : ""}*.vsix`,
|
|
1778
|
+
`${options.multiProject ? "**/" : ""}*.{vsix,VSIX,Vsix}`,
|
|
1733
1779
|
options,
|
|
1734
1780
|
);
|
|
1735
1781
|
}
|
|
@@ -1764,32 +1810,68 @@ export async function createVscodeExtensionBom(path, options) {
|
|
|
1764
1810
|
}
|
|
1765
1811
|
}
|
|
1766
1812
|
|
|
1767
|
-
// Mode 2:
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1813
|
+
// Mode 2: The path is an editor's extensions folder, such as
|
|
1814
|
+
// ~/.cursor/extensions copied off a workstation, or one extension in such a
|
|
1815
|
+
// folder. A source repository that contains an extension is neither. The
|
|
1816
|
+
// editor's own version is looked up beside the folder, never among this
|
|
1817
|
+
// machine's installed applications.
|
|
1818
|
+
const resolvedPath = resolve(path);
|
|
1819
|
+
const pathIdeDirs = [];
|
|
1820
|
+
const pathFolder = (dir, only) => {
|
|
1821
|
+
const ide = identifyIdeFromExtensionsDir(dir);
|
|
1822
|
+
return {
|
|
1823
|
+
...(ide || { name: undefined }),
|
|
1824
|
+
dir,
|
|
1825
|
+
only,
|
|
1826
|
+
probeApps: false,
|
|
1827
|
+
};
|
|
1828
|
+
};
|
|
1829
|
+
if (!isVsixPath && safeExistsSync(resolvedPath)) {
|
|
1830
|
+
if (isInstalledExtensionsDir(resolvedPath)) {
|
|
1831
|
+
pathIdeDirs.push(pathFolder(resolvedPath));
|
|
1832
|
+
} else if (
|
|
1833
|
+
isInstalledExtensionsDir(dirname(resolvedPath)) &&
|
|
1834
|
+
isInstalledExtensionDir(resolvedPath)
|
|
1835
|
+
) {
|
|
1836
|
+
pathIdeDirs.push(
|
|
1837
|
+
pathFolder(dirname(resolvedPath), basename(resolvedPath)),
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// Mode 3: Auto-discover extensions from known IDE locations when the path
|
|
1843
|
+
// held nothing to scan, so `cdxgen -t ide` in any folder reads this host
|
|
1844
|
+
// while `cdxgen -t ide <folder of .vsix files>` reads only that folder.
|
|
1845
|
+
const hostIdeDirs =
|
|
1846
|
+
shouldDiscoverInstalledIdeExtensions &&
|
|
1847
|
+
!pathIdeDirs.length &&
|
|
1848
|
+
!vsixFiles.length
|
|
1849
|
+
? discoverIdeExtensionDirs()
|
|
1850
|
+
: [];
|
|
1851
|
+
if (hostIdeDirs.length && DEBUG_MODE) {
|
|
1852
|
+
console.log(
|
|
1853
|
+
`Discovered IDE extension directories: ${hostIdeDirs.map((d) => `${d.name}: ${d.dir}`).join(", ")}`,
|
|
1854
|
+
);
|
|
1855
|
+
}
|
|
1856
|
+
const ideDirs = [...pathIdeDirs, ...hostIdeDirs];
|
|
1857
|
+
if (ideDirs.length) {
|
|
1858
|
+
const inventory = collectIdeInventory(ideDirs);
|
|
1859
|
+
if (inventory.components.length) {
|
|
1771
1860
|
if (DEBUG_MODE) {
|
|
1772
1861
|
console.log(
|
|
1773
|
-
`
|
|
1862
|
+
`Found ${inventory.components.length} IDE and extension component(s) in ${ideDirs.length} folder(s)`,
|
|
1774
1863
|
);
|
|
1775
1864
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
await analyzeInstalledExtensionDirs(
|
|
1787
|
-
ideDir.dir,
|
|
1788
|
-
options,
|
|
1789
|
-
pkgList,
|
|
1790
|
-
dependencies,
|
|
1791
|
-
);
|
|
1792
|
-
}
|
|
1865
|
+
pkgList = pkgList.concat(inventory.components);
|
|
1866
|
+
dependencies = mergeDependencies(dependencies, inventory.dependencies);
|
|
1867
|
+
for (const ideDir of ideDirs) {
|
|
1868
|
+
await analyzeInstalledExtensionDirs(
|
|
1869
|
+
ideDir.dir,
|
|
1870
|
+
options,
|
|
1871
|
+
pkgList,
|
|
1872
|
+
dependencies,
|
|
1873
|
+
ideDir.only,
|
|
1874
|
+
);
|
|
1793
1875
|
}
|
|
1794
1876
|
}
|
|
1795
1877
|
}
|
|
@@ -1798,7 +1880,9 @@ export async function createVscodeExtensionBom(path, options) {
|
|
|
1798
1880
|
for (const td of tempDirs) {
|
|
1799
1881
|
cleanupTempDir(td);
|
|
1800
1882
|
}
|
|
1801
|
-
|
|
1883
|
+
// A .vsix and the folder it was installed into describe one build; merge
|
|
1884
|
+
// them before trimComponents keeps only the first.
|
|
1885
|
+
pkgList = trimComponents(mergeExtensionComponents(pkgList));
|
|
1802
1886
|
return buildBomNSData(options, pkgList, VSCODE_EXTENSION_PURL_TYPE, {
|
|
1803
1887
|
src: path,
|
|
1804
1888
|
filename: vsixFiles.join(", "),
|
|
@@ -2189,12 +2273,14 @@ export async function analyzeExtensionDir(extDir, options) {
|
|
|
2189
2273
|
* @param {Object} options CLI options
|
|
2190
2274
|
* @param {Object[]} pkgList Mutable array to push discovered components into
|
|
2191
2275
|
* @param {Object[]} dependencies Mutable array to merge dependencies into
|
|
2276
|
+
* @param {string} [onlyEntry] Analyze only this extension folder
|
|
2192
2277
|
*/
|
|
2193
2278
|
export async function analyzeInstalledExtensionDirs(
|
|
2194
2279
|
extensionsDir,
|
|
2195
2280
|
options,
|
|
2196
2281
|
pkgList,
|
|
2197
2282
|
dependencies,
|
|
2283
|
+
onlyEntry,
|
|
2198
2284
|
) {
|
|
2199
2285
|
let entries;
|
|
2200
2286
|
try {
|
|
@@ -2206,6 +2292,9 @@ export async function analyzeInstalledExtensionDirs(
|
|
|
2206
2292
|
if (!entry.isDirectory() || entry.name.startsWith(".")) {
|
|
2207
2293
|
continue;
|
|
2208
2294
|
}
|
|
2295
|
+
if (onlyEntry && entry.name !== onlyEntry) {
|
|
2296
|
+
continue;
|
|
2297
|
+
}
|
|
2209
2298
|
const extDir = join(extensionsDir, entry.name);
|
|
2210
2299
|
const deepResult = await analyzeExtensionDir(extDir, options);
|
|
2211
2300
|
if (deepResult.pkgList.length) {
|