@cdxgen/cdxgen 13.3.0 → 13.5.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 +12 -9
- package/bin/cdxgen-secure.js +15 -0
- package/bin/cdxgen.js +115 -31
- package/bin/evinse.js +23 -1
- package/bin/hbom.js +15 -7
- package/bin/repl.js +115 -0
- package/bin/sign.js +45 -15
- package/bin/tracebom.js +5 -1
- package/bin/validate.js +84 -18
- package/bin/verify.js +155 -86
- package/data/cbomosdb-queries.json +13 -1
- package/data/component-tags.json +8 -0
- package/data/helpers/init.gradle +46 -21
- package/data/queries-darwin.json +25 -1
- package/data/queries-win.json +19 -1
- package/data/queries.json +41 -0
- package/data/remediations.json +344 -1
- package/data/rules/cbom-security.yaml +235 -4
- package/data/rules/dependency-sources.yaml +67 -0
- package/data/rules/go-binaries.yaml +46 -0
- package/data/rules/golem-go.yaml +80 -0
- package/data/rules/hbom-compliance.yaml +40 -22
- package/data/rules/hbom-performance.yaml +7 -1
- package/data/rules/host-topology.yaml +1 -1
- package/data/rules/obom-runtime.yaml +31 -2
- package/data/rules/php-runtime.yaml +143 -0
- package/data/rules/scala-evidence.yaml +115 -0
- package/lib/audit/index.js +52 -6
- package/lib/cli/bomAssembly.js +28 -3
- package/lib/cli/cliOptions.js +110 -3
- package/lib/cli/index.js +186 -58
- package/lib/cli/jsBom.js +50 -29
- package/lib/cli/jvmBom.js +779 -146
- package/lib/cli/managedBom.js +1021 -261
- package/lib/cli/nativeBom.js +364 -58
- package/lib/core/activity.js +12 -0
- package/lib/core/env.js +47 -17
- package/lib/core/fs.js +31 -21
- package/lib/core/httpClient.js +233 -69
- package/lib/core/pluginRun.js +184 -0
- package/lib/core/processTree.js +100 -0
- package/lib/core/projectConfig.js +1 -0
- package/lib/core/projectTooling.js +97 -0
- package/lib/core/propertySanitizer.js +72 -0
- package/lib/core/runState.js +39 -0
- package/lib/core/toml.js +72 -0
- package/lib/ecosystems/asarutils.js +4 -2
- package/lib/ecosystems/bunutils.js +5 -7
- package/lib/ecosystems/cargoCache.js +231 -8
- package/lib/ecosystems/cmakeResolver.js +10 -21
- package/lib/ecosystems/cppBuildContext.js +631 -0
- package/lib/ecosystems/cppEvidence.js +337 -22
- package/lib/ecosystems/cppIncludeResolver.js +294 -0
- package/lib/ecosystems/denoutils.js +93 -66
- package/lib/ecosystems/ecosystems.js +1967 -788
- package/lib/ecosystems/golem.js +578 -18
- package/lib/ecosystems/gradleutils.js +340 -46
- package/lib/ecosystems/jsEvidence.js +85 -24
- package/lib/ecosystems/kosi.js +21 -4
- package/lib/ecosystems/npmutils.js +64 -0
- package/lib/ecosystems/parsers-dotnet.js +668 -153
- package/lib/ecosystems/parsers-elm.js +46 -28
- package/lib/ecosystems/parsers-gleam.js +3 -4
- package/lib/ecosystems/parsers-go.js +1283 -297
- package/lib/ecosystems/parsers-js.js +92 -26
- package/lib/ecosystems/parsers-julia.js +2 -3
- package/lib/ecosystems/parsers-jvm.js +463 -29
- package/lib/ecosystems/parsers-misc.js +405 -93
- package/lib/ecosystems/parsers-python.js +152 -20
- package/lib/ecosystems/parsers-rust.js +4 -4
- package/lib/ecosystems/parsers-terraform.js +1573 -19
- package/lib/ecosystems/pythonutils.js +102 -6
- package/lib/ecosystems/remote/huggingface.js +3 -0
- package/lib/ecosystems/rubyutils.js +73 -20
- package/lib/ecosystems/rusi.js +32 -9
- package/lib/ecosystems/sbtutils.js +243 -187
- package/lib/ecosystems/scalacliutils.js +343 -0
- package/lib/ecosystems/scalasem.js +2620 -0
- package/lib/ecosystems/terraformRegistry.js +288 -0
- package/lib/ecosystems/utils.js +2 -0
- package/lib/ecosystems/vendoredCode.js +156 -0
- package/lib/evinser/evinser.js +695 -78
- package/lib/evinser/swiftsem.js +68 -5
- package/lib/helpers/agenticToolutils.js +2 -2
- package/lib/helpers/bomSigner.js +576 -128
- package/lib/inventory/agentSkillSpec.js +17 -0
- package/lib/inventory/aiCollector.js +4 -1
- package/lib/inventory/analyzer.js +110 -127
- package/lib/inventory/apkInstalledDb.js +243 -0
- package/lib/inventory/atomUtils.js +204 -48
- package/lib/inventory/auditCategories.js +10 -3
- package/lib/inventory/buildToolRateLimit.js +144 -0
- package/lib/inventory/cacheCommands.js +2 -1
- package/lib/inventory/cacheDir.js +52 -9
- package/lib/inventory/certificates.js +2371 -0
- package/lib/inventory/cmakeBuildDirs.js +254 -0
- package/lib/inventory/communityAiConfigParser.js +4 -9
- package/lib/inventory/deps.js +507 -128
- package/lib/inventory/display.js +200 -3
- package/lib/inventory/dosai.js +747 -101
- package/lib/inventory/dosaiParsers.js +310 -15
- package/lib/inventory/dynamic.js +96 -8
- package/lib/inventory/envcontext.js +168 -5
- package/lib/inventory/evidenceUtils.js +590 -132
- package/lib/inventory/fetchBatch.js +574 -38
- package/lib/inventory/fetchDiskCache.js +597 -0
- package/lib/inventory/forgeEnricher.js +14 -5
- package/lib/inventory/formulationParsers.js +3 -2
- package/lib/inventory/goBuildInfo.js +140 -0
- package/lib/inventory/hbom.js +67 -7
- package/lib/inventory/hbomAnalysis.js +16 -0
- package/lib/inventory/hostTopology.js +21 -0
- package/lib/inventory/jvmLocalRepos.js +917 -0
- package/lib/inventory/mcpConfigParser.js +2 -3
- package/lib/inventory/osPackagePurl.js +244 -0
- package/lib/inventory/osPackageResolver.js +89 -87
- package/lib/inventory/osinfo.js +79 -31
- package/lib/inventory/osqueryTransform.js +114 -5
- package/lib/inventory/parentSelection.js +146 -0
- package/lib/inventory/phpBuildInfo.js +487 -0
- package/lib/inventory/phpHostProbe.js +641 -0
- package/lib/inventory/rootfsCerts.js +426 -0
- package/lib/inventory/rustFormulationParser.js +3 -4
- package/lib/inventory/scalaCoords.js +153 -0
- package/lib/inventory/source.js +215 -11
- package/lib/inventory/spdx.js +245 -0
- package/lib/inventory/traceRunner.js +93 -8
- package/lib/inventory/tracedCrypto.js +423 -0
- package/lib/managers/binary.js +529 -183
- package/lib/managers/docker.js +199 -44
- package/lib/managers/oci.js +24 -2
- package/lib/parsers/cmakeCache.js +69 -0
- package/lib/parsers/cmakeLists.js +16 -2
- package/lib/parsers/cmakePresets.js +400 -0
- package/lib/parsers/compileCommands.js +557 -0
- package/lib/parsers/email.js +277 -0
- package/lib/parsers/largeJson.js +34 -2
- package/lib/parsers/strictJson.js +322 -0
- package/lib/parsers/terraformConfig.js +1073 -0
- package/lib/parsers/terraformSource.js +652 -0
- package/lib/server/server.js +209 -1
- package/lib/stages/postgen/annotator.js +17 -1
- package/lib/stages/postgen/introspection/markers.js +1 -1
- package/lib/stages/postgen/introspection/reflect.js +4 -1
- package/lib/stages/postgen/postgen.js +20 -6
- package/lib/stages/postgen/ruleEngine.js +58 -1
- package/lib/stages/postgen/specVersionCompat.js +62 -0
- package/lib/stages/pregen/pregen.js +117 -5
- package/lib/validator/bomValidator.js +26 -5
- package/lib/validator/generated/runtime.mjs +13 -0
- package/lib/validator/generated/validate-1.6.mjs +26 -7
- package/lib/validator/generated/validate-1.7.mjs +31 -12
- package/lib/validator/generated/validate-2.0.mjs +30 -11
- package/lib/validator/index.js +25 -10
- package/lib/validator/reporters/json.js +1 -0
- package/package.json +23 -23
- package/types/bin/cdxgen-secure.d.ts +3 -0
- package/types/bin/cdxgen-secure.d.ts.map +1 -0
- package/types/bin/repl.d.ts.map +1 -1
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts +9 -2
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +43 -0
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts +44 -1
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts +7 -4
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts +3 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/activity.d.ts.map +1 -1
- package/types/lib/core/env.d.ts +27 -2
- 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 +13 -8
- package/types/lib/core/httpClient.d.ts.map +1 -1
- package/types/lib/core/pluginRun.d.ts +97 -0
- package/types/lib/core/pluginRun.d.ts.map +1 -0
- package/types/lib/core/processTree.d.ts +36 -0
- package/types/lib/core/processTree.d.ts.map +1 -0
- package/types/lib/core/projectConfig.d.ts.map +1 -1
- package/types/lib/core/projectTooling.d.ts +41 -0
- package/types/lib/core/projectTooling.d.ts.map +1 -0
- package/types/lib/core/propertySanitizer.d.ts +26 -0
- package/types/lib/core/propertySanitizer.d.ts.map +1 -1
- package/types/lib/core/runState.d.ts +29 -0
- package/types/lib/core/runState.d.ts.map +1 -0
- package/types/lib/core/toml.d.ts +20 -0
- package/types/lib/core/toml.d.ts.map +1 -0
- package/types/lib/ecosystems/asarutils.d.ts.map +1 -1
- package/types/lib/ecosystems/bunutils.d.ts.map +1 -1
- package/types/lib/ecosystems/cargoCache.d.ts +12 -0
- package/types/lib/ecosystems/cargoCache.d.ts.map +1 -1
- package/types/lib/ecosystems/cmakeResolver.d.ts +5 -3
- package/types/lib/ecosystems/cmakeResolver.d.ts.map +1 -1
- package/types/lib/ecosystems/cppBuildContext.d.ts +55 -0
- package/types/lib/ecosystems/cppBuildContext.d.ts.map +1 -0
- package/types/lib/ecosystems/cppEvidence.d.ts +19 -3
- package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts +92 -0
- package/types/lib/ecosystems/cppIncludeResolver.d.ts.map +1 -0
- package/types/lib/ecosystems/denoutils.d.ts +9 -3
- package/types/lib/ecosystems/denoutils.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts +62 -13
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/golem.d.ts +81 -1
- package/types/lib/ecosystems/golem.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +59 -7
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/jsEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/kosi.d.ts.map +1 -1
- package/types/lib/ecosystems/npmutils.d.ts +15 -0
- package/types/lib/ecosystems/npmutils.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-dotnet.d.ts +155 -5
- package/types/lib/ecosystems/parsers-dotnet.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-elm.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-gleam.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-go.d.ts +119 -5
- package/types/lib/ecosystems/parsers-go.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-js.d.ts +6 -1
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-julia.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-jvm.d.ts +74 -3
- package/types/lib/ecosystems/parsers-jvm.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts +21 -59
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts +57 -6
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-terraform.d.ts +38 -21
- package/types/lib/ecosystems/parsers-terraform.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +26 -1
- package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
- package/types/lib/ecosystems/remote/huggingface.d.ts.map +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts +21 -1
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/ecosystems/sbtutils.d.ts +88 -2
- package/types/lib/ecosystems/sbtutils.d.ts.map +1 -1
- package/types/lib/ecosystems/scalacliutils.d.ts +56 -0
- package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -0
- package/types/lib/ecosystems/scalasem.d.ts +311 -0
- package/types/lib/ecosystems/scalasem.d.ts.map +1 -0
- package/types/lib/ecosystems/terraformRegistry.d.ts +9 -0
- package/types/lib/ecosystems/terraformRegistry.d.ts.map +1 -0
- package/types/lib/ecosystems/utils.d.ts +2 -2
- package/types/lib/ecosystems/utils.d.ts.map +1 -1
- package/types/lib/ecosystems/vendoredCode.d.ts +32 -0
- package/types/lib/ecosystems/vendoredCode.d.ts.map +1 -0
- package/types/lib/evinser/evinser.d.ts +100 -8
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/evinser/swiftsem.d.ts +10 -0
- package/types/lib/evinser/swiftsem.d.ts.map +1 -1
- package/types/lib/helpers/bomSigner.d.ts +80 -4
- package/types/lib/helpers/bomSigner.d.ts.map +1 -1
- package/types/lib/inventory/agentSkillSpec.d.ts +13 -0
- package/types/lib/inventory/agentSkillSpec.d.ts.map +1 -0
- package/types/lib/inventory/aiCollector.d.ts.map +1 -1
- package/types/lib/inventory/analyzer.d.ts.map +1 -1
- package/types/lib/inventory/apkInstalledDb.d.ts +42 -0
- package/types/lib/inventory/apkInstalledDb.d.ts.map +1 -0
- package/types/lib/inventory/atomUtils.d.ts +96 -10
- package/types/lib/inventory/atomUtils.d.ts.map +1 -1
- package/types/lib/inventory/auditCategories.d.ts +3 -0
- package/types/lib/inventory/auditCategories.d.ts.map +1 -1
- package/types/lib/inventory/buildToolRateLimit.d.ts +38 -0
- package/types/lib/inventory/buildToolRateLimit.d.ts.map +1 -0
- package/types/lib/inventory/cacheCommands.d.ts +2 -1
- package/types/lib/inventory/cacheCommands.d.ts.map +1 -1
- package/types/lib/inventory/cacheDir.d.ts +12 -4
- package/types/lib/inventory/cacheDir.d.ts.map +1 -1
- package/types/lib/inventory/certificates.d.ts +205 -0
- package/types/lib/inventory/certificates.d.ts.map +1 -0
- package/types/lib/inventory/cmakeBuildDirs.d.ts +58 -0
- package/types/lib/inventory/cmakeBuildDirs.d.ts.map +1 -0
- package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/deps.d.ts +61 -2
- package/types/lib/inventory/deps.d.ts.map +1 -1
- package/types/lib/inventory/display.d.ts +18 -0
- package/types/lib/inventory/display.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +202 -14
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dosaiParsers.d.ts +53 -7
- package/types/lib/inventory/dosaiParsers.d.ts.map +1 -1
- package/types/lib/inventory/dynamic.d.ts +16 -1
- package/types/lib/inventory/dynamic.d.ts.map +1 -1
- package/types/lib/inventory/envcontext.d.ts +40 -2
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts +48 -14
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/fetchBatch.d.ts +83 -14
- package/types/lib/inventory/fetchBatch.d.ts.map +1 -1
- package/types/lib/inventory/fetchDiskCache.d.ts +169 -0
- package/types/lib/inventory/fetchDiskCache.d.ts.map +1 -0
- package/types/lib/inventory/forgeEnricher.d.ts.map +1 -1
- package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
- package/types/lib/inventory/goBuildInfo.d.ts +10 -0
- package/types/lib/inventory/goBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/hbom.d.ts.map +1 -1
- package/types/lib/inventory/hbomAnalysis.d.ts +10 -0
- package/types/lib/inventory/hbomAnalysis.d.ts.map +1 -1
- package/types/lib/inventory/hostTopology.d.ts.map +1 -1
- package/types/lib/inventory/jvmLocalRepos.d.ts +178 -0
- package/types/lib/inventory/jvmLocalRepos.d.ts.map +1 -0
- package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/osPackagePurl.d.ts +99 -0
- package/types/lib/inventory/osPackagePurl.d.ts.map +1 -0
- package/types/lib/inventory/osPackageResolver.d.ts +6 -2
- package/types/lib/inventory/osPackageResolver.d.ts.map +1 -1
- package/types/lib/inventory/osinfo.d.ts +31 -6
- package/types/lib/inventory/osinfo.d.ts.map +1 -1
- package/types/lib/inventory/osqueryTransform.d.ts +51 -0
- package/types/lib/inventory/osqueryTransform.d.ts.map +1 -1
- package/types/lib/inventory/parentSelection.d.ts +34 -0
- package/types/lib/inventory/parentSelection.d.ts.map +1 -0
- package/types/lib/inventory/phpBuildInfo.d.ts +142 -0
- package/types/lib/inventory/phpBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/phpHostProbe.d.ts +35 -0
- package/types/lib/inventory/phpHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/rootfsCerts.d.ts +27 -0
- package/types/lib/inventory/rootfsCerts.d.ts.map +1 -0
- package/types/lib/inventory/rustFormulationParser.d.ts.map +1 -1
- package/types/lib/inventory/scalaCoords.d.ts +80 -0
- package/types/lib/inventory/scalaCoords.d.ts.map +1 -0
- package/types/lib/inventory/source.d.ts +28 -0
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/inventory/spdx.d.ts +24 -0
- package/types/lib/inventory/spdx.d.ts.map +1 -1
- package/types/lib/inventory/traceRunner.d.ts +16 -1
- package/types/lib/inventory/traceRunner.d.ts.map +1 -1
- package/types/lib/inventory/tracedCrypto.d.ts +64 -0
- package/types/lib/inventory/tracedCrypto.d.ts.map +1 -0
- package/types/lib/managers/binary.d.ts +10 -0
- 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/managers/oci.d.ts +3 -1
- package/types/lib/managers/oci.d.ts.map +1 -1
- package/types/lib/parsers/cmakeCache.d.ts +16 -0
- package/types/lib/parsers/cmakeCache.d.ts.map +1 -1
- package/types/lib/parsers/cmakeLists.d.ts +2 -1
- package/types/lib/parsers/cmakeLists.d.ts.map +1 -1
- package/types/lib/parsers/cmakePresets.d.ts +78 -0
- package/types/lib/parsers/cmakePresets.d.ts.map +1 -0
- package/types/lib/parsers/compileCommands.d.ts +115 -0
- package/types/lib/parsers/compileCommands.d.ts.map +1 -0
- package/types/lib/parsers/email.d.ts +19 -0
- package/types/lib/parsers/email.d.ts.map +1 -0
- package/types/lib/parsers/largeJson.d.ts +13 -0
- package/types/lib/parsers/largeJson.d.ts.map +1 -1
- package/types/lib/parsers/strictJson.d.ts +46 -0
- package/types/lib/parsers/strictJson.d.ts.map +1 -0
- package/types/lib/parsers/terraformConfig.d.ts +70 -0
- package/types/lib/parsers/terraformConfig.d.ts.map +1 -0
- package/types/lib/parsers/terraformSource.d.ts +66 -0
- package/types/lib/parsers/terraformSource.d.ts.map +1 -0
- package/types/lib/server/server.d.ts +8 -0
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/lib/stages/postgen/annotator.d.ts.map +1 -1
- package/types/lib/stages/postgen/introspection/reflect.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts +7 -4
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +14 -1
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
- package/types/lib/validator/index.d.ts +8 -0
- package/types/lib/validator/index.d.ts.map +1 -1
- package/types/lib/validator/reporters/json.d.ts.map +1 -1
- package/lib/third-party/arborist/snapshots/calc-dep-flags.test.cjs +0 -462
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which package provides a C/C++ header, from the file the include resolved
|
|
3
|
+
* to. atom 4 and later name that file in each include's usages slice
|
|
4
|
+
* (`resolvedPath`); with it, a header is attributed exactly instead of by its
|
|
5
|
+
* name: to the project itself, to a dependency whose sources CMake fetched or
|
|
6
|
+
* a submodule checked out, to code the project vendors, to a port vcpkg
|
|
7
|
+
* installed, to a package in the Conan cache, or to the operating-system
|
|
8
|
+
* package that owns the file.
|
|
9
|
+
*
|
|
10
|
+
* Layer 3: reads the vcpkg installed tree and the Conan cache, and asks the
|
|
11
|
+
* OS package manager about a file (`dpkg-query -S`, `rpm -qf`, `apk info -W`,
|
|
12
|
+
* or the Homebrew Cellar path).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { readdirSync, readFileSync, realpathSync } from "node:fs";
|
|
16
|
+
import { homedir } from "node:os";
|
|
17
|
+
import { isAbsolute, join, resolve, sep } from "node:path";
|
|
18
|
+
import process from "node:process";
|
|
19
|
+
|
|
20
|
+
import { readEnvironmentVariable } from "../core/activity.js";
|
|
21
|
+
import { safeExistsSync } from "../core/fs.js";
|
|
22
|
+
import { isInsideDir } from "../inventory/cmakeBuildDirs.js";
|
|
23
|
+
import { resolvePackageForFile } from "../inventory/osPackageResolver.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The include slices of an atom C/C++ usages report: for each header as
|
|
27
|
+
* written, the files it resolved to, whether it was written as a system
|
|
28
|
+
* include, and the functions the including files call that it declares.
|
|
29
|
+
* Slices from atom releases that do not name the resolved file contribute no
|
|
30
|
+
* paths and no symbols.
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} sliceData Parsed atom usages report
|
|
33
|
+
* @returns {Map<string, {paths: Set<string>, system: boolean, symbols: Set<string>}>}
|
|
34
|
+
*/
|
|
35
|
+
export function parseCIncludeSlices(sliceData) {
|
|
36
|
+
const includes = new Map();
|
|
37
|
+
for (const slice of sliceData?.objectSlices || []) {
|
|
38
|
+
if (!slice || !`${slice.code || ""}`.startsWith("#include")) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const header = slice.fullName;
|
|
42
|
+
if (!header) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const entry = includes.get(header) || {
|
|
46
|
+
paths: new Set(),
|
|
47
|
+
system: false,
|
|
48
|
+
symbols: new Set(),
|
|
49
|
+
};
|
|
50
|
+
if (typeof slice.resolvedPath === "string" && slice.resolvedPath.length) {
|
|
51
|
+
entry.paths.add(slice.resolvedPath);
|
|
52
|
+
}
|
|
53
|
+
entry.system = entry.system || slice.isSystem === true;
|
|
54
|
+
for (const symbol of Array.isArray(slice.importedSymbols)
|
|
55
|
+
? slice.importedSymbols
|
|
56
|
+
: []) {
|
|
57
|
+
if (typeof symbol === "string" && symbol.length) {
|
|
58
|
+
entry.symbols.add(symbol);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
includes.set(header, entry);
|
|
62
|
+
}
|
|
63
|
+
return includes;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Index the ports vcpkg installed into the given `vcpkg_installed`
|
|
68
|
+
* directories: every file a port installed, by absolute path. vcpkg lists a
|
|
69
|
+
* port's files in `vcpkg/info/<port>_<version>_<triplet>.list`, one path per
|
|
70
|
+
* line relative to the installed directory.
|
|
71
|
+
*
|
|
72
|
+
* @param {string[]} installedDirs `vcpkg_installed` directories
|
|
73
|
+
* @returns {Map<string, {port: string, version: string, triplet: string}>}
|
|
74
|
+
*/
|
|
75
|
+
export function readVcpkgInstalledIndex(installedDirs) {
|
|
76
|
+
const index = new Map();
|
|
77
|
+
for (const dir of installedDirs) {
|
|
78
|
+
const infoDir = join(dir, "vcpkg", "info");
|
|
79
|
+
let lists = [];
|
|
80
|
+
try {
|
|
81
|
+
lists = readdirSync(infoDir).filter((f) => f.endsWith(".list"));
|
|
82
|
+
} catch (_err) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
for (const list of lists) {
|
|
86
|
+
const stem = list.slice(0, -".list".length);
|
|
87
|
+
const first = stem.indexOf("_");
|
|
88
|
+
const last = stem.lastIndexOf("_");
|
|
89
|
+
if (first <= 0 || last <= first) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const port = stem.slice(0, first);
|
|
93
|
+
const version = stem.slice(first + 1, last);
|
|
94
|
+
const triplet = stem.slice(last + 1);
|
|
95
|
+
let text = "";
|
|
96
|
+
try {
|
|
97
|
+
text = readFileSync(join(infoDir, list), "utf-8");
|
|
98
|
+
} catch (_err) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
for (const line of text.split(/\r?\n/)) {
|
|
102
|
+
const rel = line.trim();
|
|
103
|
+
if (!rel || rel.endsWith("/")) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
index.set(resolve(dir, rel), { port, version, triplet });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return index;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The package folders of a Conan 2 cache, from its database
|
|
115
|
+
* (`<home>/p/cache.sqlite3`, table `packages`).
|
|
116
|
+
*
|
|
117
|
+
* @param {string} conanHome Conan 2 home (`CONAN_HOME`, or `~/.conan2`)
|
|
118
|
+
* @returns {Array<{dir: string, name: string, version: string}>}
|
|
119
|
+
*/
|
|
120
|
+
export function conan2Packages(conanHome) {
|
|
121
|
+
const packages = [];
|
|
122
|
+
const db = join(conanHome, "p", "cache.sqlite3");
|
|
123
|
+
if (!safeExistsSync(db)) {
|
|
124
|
+
return packages;
|
|
125
|
+
}
|
|
126
|
+
const sqlite = process.getBuiltinModule?.("node:sqlite");
|
|
127
|
+
if (!sqlite?.DatabaseSync) {
|
|
128
|
+
return packages;
|
|
129
|
+
}
|
|
130
|
+
let handle;
|
|
131
|
+
try {
|
|
132
|
+
handle = new sqlite.DatabaseSync(db, { readOnly: true });
|
|
133
|
+
for (const row of handle
|
|
134
|
+
.prepare("SELECT reference, path FROM packages")
|
|
135
|
+
.all()) {
|
|
136
|
+
if (typeof row.reference === "string" && typeof row.path === "string") {
|
|
137
|
+
const [name, version] = row.reference.split("@")[0].split("/");
|
|
138
|
+
if (name && version) {
|
|
139
|
+
packages.push({
|
|
140
|
+
dir: resolve(conanHome, "p", row.path),
|
|
141
|
+
name,
|
|
142
|
+
version,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} catch (_err) {
|
|
148
|
+
// a database of another layout tells nothing
|
|
149
|
+
} finally {
|
|
150
|
+
try {
|
|
151
|
+
handle?.close();
|
|
152
|
+
} catch (_err) {
|
|
153
|
+
// already closed
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return packages;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The Conan package a file belongs to: in a Conan 1 cache
|
|
161
|
+
* (`<home>/.conan/data/<name>/<version>/<user>/<channel>/package/<id>/...`)
|
|
162
|
+
* from its path, in a Conan 2 cache from the cache's database.
|
|
163
|
+
*
|
|
164
|
+
* @param {string} file Absolute path
|
|
165
|
+
* @param {Object[]} conan2 Conan 2 package folders (see `conan2Packages`)
|
|
166
|
+
* @returns {{name: string, version: string}|undefined}
|
|
167
|
+
*/
|
|
168
|
+
export function conanPackageOf(file, conan2) {
|
|
169
|
+
const segments = file.split(sep);
|
|
170
|
+
const data = segments.findIndex(
|
|
171
|
+
(s, i) => s === "data" && segments[i - 1] === ".conan",
|
|
172
|
+
);
|
|
173
|
+
if (
|
|
174
|
+
data >= 0 &&
|
|
175
|
+
segments.length > data + 6 &&
|
|
176
|
+
segments[data + 5] === "package"
|
|
177
|
+
) {
|
|
178
|
+
return { name: segments[data + 1], version: segments[data + 2] };
|
|
179
|
+
}
|
|
180
|
+
const hit = conan2.find((p) => isInsideDir(file, p.dir));
|
|
181
|
+
return hit ? { name: hit.name, version: hit.version } : undefined;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function propertyValue(component, name) {
|
|
185
|
+
return (component?.properties || []).find((p) => p.name === name)?.value;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Build the function that attributes a header from the files it resolved
|
|
190
|
+
* to.
|
|
191
|
+
*
|
|
192
|
+
* @param {Object} context
|
|
193
|
+
* @param {string} context.src Project scan root
|
|
194
|
+
* @param {Object[]} [context.components] Components already known: CMake
|
|
195
|
+
* dependencies (`cdx:cmake:sourceDir`) and vendored code
|
|
196
|
+
* (`cdx:vendored:path`) claim the headers under their directories
|
|
197
|
+
* @param {string[]} [context.buildDirs] Build directories, searched for
|
|
198
|
+
* `vcpkg_installed`
|
|
199
|
+
* @param {function(string): boolean} [context.isFirstPartyHeader] Whether a
|
|
200
|
+
* file is the project's own
|
|
201
|
+
* @returns {function(Iterable<string>): Object|undefined} Given the resolved
|
|
202
|
+
* files, `{kind: "first-party"}`, `{kind: "component", component}`,
|
|
203
|
+
* `{kind: "vcpkg", port, version, triplet}`, `{kind: "conan", name,
|
|
204
|
+
* version}`, `{kind: "os", pkgInfo}`, or `undefined` when no file says.
|
|
205
|
+
* Its `vcpkgPorts()` lists the ports vcpkg installed.
|
|
206
|
+
*/
|
|
207
|
+
export function createIncludeAttributor(context) {
|
|
208
|
+
const root = resolve(context.src);
|
|
209
|
+
const owners = [];
|
|
210
|
+
for (const component of context.components || []) {
|
|
211
|
+
for (const name of ["cdx:cmake:sourceDir", "cdx:vendored:path"]) {
|
|
212
|
+
const dir = propertyValue(component, name);
|
|
213
|
+
if (dir) {
|
|
214
|
+
owners.push({ dir: resolve(root, dir), component });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// the deepest directory owns a file inside nested ones
|
|
219
|
+
owners.sort((a, b) => b.dir.length - a.dir.length);
|
|
220
|
+
const installedDirs = [root, ...(context.buildDirs || [])]
|
|
221
|
+
.map((d) => join(d, "vcpkg_installed"))
|
|
222
|
+
.filter((d) => safeExistsSync(d));
|
|
223
|
+
let vcpkgIndex;
|
|
224
|
+
const vcpkg = () => {
|
|
225
|
+
vcpkgIndex = vcpkgIndex || readVcpkgInstalledIndex(installedDirs);
|
|
226
|
+
return vcpkgIndex;
|
|
227
|
+
};
|
|
228
|
+
const conanHome =
|
|
229
|
+
readEnvironmentVariable("CONAN_HOME") || join(homedir(), ".conan2");
|
|
230
|
+
let conan2;
|
|
231
|
+
const conan2Folders = () => {
|
|
232
|
+
conan2 = conan2 || conan2Packages(conanHome);
|
|
233
|
+
return conan2;
|
|
234
|
+
};
|
|
235
|
+
const real = (p) => {
|
|
236
|
+
try {
|
|
237
|
+
return realpathSync(p);
|
|
238
|
+
} catch (_err) {
|
|
239
|
+
return resolve(p);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const attributeOne = (file) => {
|
|
243
|
+
if (!file || !isAbsolute(file)) {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
const abs = resolve(file);
|
|
247
|
+
const owner = owners.find((o) => isInsideDir(abs, o.dir));
|
|
248
|
+
if (owner) {
|
|
249
|
+
return { kind: "component", component: owner.component };
|
|
250
|
+
}
|
|
251
|
+
if (context.isFirstPartyHeader?.(abs)) {
|
|
252
|
+
return { kind: "first-party" };
|
|
253
|
+
}
|
|
254
|
+
const port =
|
|
255
|
+
installedDirs.length && (vcpkg().get(abs) || vcpkg().get(real(abs)));
|
|
256
|
+
if (port) {
|
|
257
|
+
return { kind: "vcpkg", ...port };
|
|
258
|
+
}
|
|
259
|
+
const conan = conanPackageOf(real(abs), conan2Folders());
|
|
260
|
+
if (conan) {
|
|
261
|
+
return { kind: "conan", ...conan };
|
|
262
|
+
}
|
|
263
|
+
if (isInsideDir(abs, root)) {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
const pkgInfo = resolvePackageForFile(real(abs));
|
|
267
|
+
if (pkgInfo?.name) {
|
|
268
|
+
return { kind: "os", pkgInfo };
|
|
269
|
+
}
|
|
270
|
+
return undefined;
|
|
271
|
+
};
|
|
272
|
+
const attribute = (files) => {
|
|
273
|
+
for (const file of files || []) {
|
|
274
|
+
const target = attributeOne(file);
|
|
275
|
+
if (target) {
|
|
276
|
+
return target;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return undefined;
|
|
280
|
+
};
|
|
281
|
+
/** The ports vcpkg installed for the project: port to version and triplet. */
|
|
282
|
+
attribute.vcpkgPorts = () => {
|
|
283
|
+
const ports = new Map();
|
|
284
|
+
if (installedDirs.length) {
|
|
285
|
+
for (const { port, version, triplet } of vcpkg().values()) {
|
|
286
|
+
if (!ports.has(port)) {
|
|
287
|
+
ports.set(port, { version, triplet });
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return ports;
|
|
292
|
+
};
|
|
293
|
+
return attribute;
|
|
294
|
+
}
|
|
@@ -6,14 +6,12 @@ import { build } from "@cdxgen/cdx-purl";
|
|
|
6
6
|
|
|
7
7
|
// utils.js does not import denoutils.js, so importing from it here is safe and
|
|
8
8
|
// does not introduce a cyclic dependency.
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
DEBUG_MODE,
|
|
12
|
-
readEnvironmentVariable,
|
|
13
|
-
} from "../core/activity.js";
|
|
14
|
-
import { shouldFetchLicense, shouldFetchVCS } from "../core/env.js";
|
|
9
|
+
import { DEBUG_MODE, readEnvironmentVariable } from "../core/activity.js";
|
|
10
|
+
import { shouldFetchPackageMetadata } from "../core/env.js";
|
|
15
11
|
import { safeExistsSync } from "../core/fs.js";
|
|
12
|
+
import { registerRunReset } from "../core/runState.js";
|
|
16
13
|
import {
|
|
14
|
+
gatedGet,
|
|
17
15
|
prefetchEnabled,
|
|
18
16
|
prefetchedResponse,
|
|
19
17
|
prefetchJson,
|
|
@@ -23,6 +21,7 @@ import {
|
|
|
23
21
|
buildNpmRegistryTarballUrl,
|
|
24
22
|
loadNpmrcConfig,
|
|
25
23
|
normalizeNpmRegistryUrl,
|
|
24
|
+
resolveNpmLicense,
|
|
26
25
|
} from "./npmutils.js";
|
|
27
26
|
|
|
28
27
|
const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/";
|
|
@@ -37,6 +36,7 @@ const JSR_API_URL =
|
|
|
37
36
|
// Small in-module response cache so repeated packages (or multiple lockfiles)
|
|
38
37
|
// don't re-fetch the same jsr metadata.
|
|
39
38
|
const jsrMetadataCache = new Map();
|
|
39
|
+
registerRunReset("jsr:documents", () => jsrMetadataCache.clear());
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* purl decision for `jsr:` dependencies.
|
|
@@ -314,8 +314,11 @@ function applyPackageJsonMetadata(component, pj) {
|
|
|
314
314
|
if (!component.description && pj.description) {
|
|
315
315
|
component.description = pj.description;
|
|
316
316
|
}
|
|
317
|
-
if (!component.license
|
|
318
|
-
|
|
317
|
+
if (!component.license) {
|
|
318
|
+
const license = resolveNpmLicense(pj);
|
|
319
|
+
if (license) {
|
|
320
|
+
component.license = license;
|
|
321
|
+
}
|
|
319
322
|
}
|
|
320
323
|
if (pj.repository) {
|
|
321
324
|
const url =
|
|
@@ -468,78 +471,104 @@ function jsrUrlsFor(component) {
|
|
|
468
471
|
};
|
|
469
472
|
}
|
|
470
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Whether a component already names its source repository, so the jsr
|
|
476
|
+
* package document, which supplies the GitHub link, has nothing left to add.
|
|
477
|
+
*
|
|
478
|
+
* @param {Object} component CycloneDX component with cdxgen properties.
|
|
479
|
+
* @returns {boolean}
|
|
480
|
+
*/
|
|
481
|
+
function hasVcsReference(component) {
|
|
482
|
+
return Boolean(
|
|
483
|
+
component.repository?.url ||
|
|
484
|
+
(component.externalReferences || []).some(
|
|
485
|
+
(ref) => ref.type === "vcs" && ref.url,
|
|
486
|
+
),
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
|
|
471
490
|
/**
|
|
472
491
|
* Fetch JSR registry metadata for deno/jsr package components.
|
|
473
492
|
*
|
|
474
|
-
* For each component carrying a `cdx:deno:jsrKey` property, fetches the
|
|
475
|
-
* and package endpoints from the JSR API
|
|
476
|
-
*
|
|
493
|
+
* For each component carrying a `cdx:deno:jsrKey` property, fetches the
|
|
494
|
+
* version and package endpoints from the JSR API and fills in license,
|
|
495
|
+
* description, and the GitHub source link. A document is requested only for
|
|
496
|
+
* a component that still misses a field that document supplies: the version
|
|
497
|
+
* document carries the license, the package document the description and the
|
|
498
|
+
* repository link, so whatever the lockfile and the installed-manifest
|
|
499
|
+
* mining filled is never asked for again. Neither document carries
|
|
500
|
+
* provenance, so a provenance fetch, as under --bom-audit, asks for nothing
|
|
501
|
+
* more.
|
|
477
502
|
*
|
|
478
503
|
* @param {Array<object>} pkgList Package components potentially enriched with `cdx:deno:jsrKey`.
|
|
479
504
|
* @returns {Promise<Array<object>>} The enriched package list (same reference as pkgList).
|
|
480
505
|
*/
|
|
481
506
|
export async function getJsrMetadata(pkgList) {
|
|
482
|
-
//
|
|
507
|
+
// The documents each component still needs, decided before the batched
|
|
508
|
+
// round so a fetch the loop would never make is not issued either.
|
|
509
|
+
const documentsByComponent = new Map();
|
|
510
|
+
for (const component of pkgList) {
|
|
511
|
+
const urls = jsrUrlsFor(component);
|
|
512
|
+
if (!urls) {
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
const documents = [];
|
|
516
|
+
if (!component.license) {
|
|
517
|
+
documents.push(urls.versionUrl);
|
|
518
|
+
}
|
|
519
|
+
if (!component.description || !hasVcsReference(component)) {
|
|
520
|
+
documents.push(urls.packageUrl);
|
|
521
|
+
}
|
|
522
|
+
documentsByComponent.set(component, documents);
|
|
523
|
+
}
|
|
483
524
|
const prefetched = await prefetchJson(
|
|
484
525
|
prefetchEnabled()
|
|
485
|
-
?
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
? [{ url: urls.versionUrl }, { url: urls.packageUrl }]
|
|
489
|
-
: [];
|
|
490
|
-
})
|
|
526
|
+
? [...new Set([...documentsByComponent.values()].flat())]
|
|
527
|
+
.filter((url) => !jsrMetadataCache.has(url))
|
|
528
|
+
.map((url) => ({ url }))
|
|
491
529
|
: [],
|
|
492
530
|
);
|
|
493
531
|
for (const component of pkgList) {
|
|
494
532
|
try {
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
)?.value;
|
|
498
|
-
if (!jsrKey) {
|
|
499
|
-
continue;
|
|
500
|
-
}
|
|
501
|
-
// jsrKey looks like `@scope/name@version`.
|
|
502
|
-
const atIndex = jsrKey.lastIndexOf("@");
|
|
503
|
-
const idPart = atIndex > 0 ? jsrKey.substring(0, atIndex) : jsrKey;
|
|
504
|
-
const version =
|
|
505
|
-
atIndex > 0 ? jsrKey.substring(atIndex + 1) : component.version;
|
|
506
|
-
const match = idPart.match(/^@([^/]+)\/(.+)$/);
|
|
507
|
-
if (!match) {
|
|
533
|
+
const urls = jsrUrlsFor(component);
|
|
534
|
+
if (!urls) {
|
|
508
535
|
continue;
|
|
509
536
|
}
|
|
510
|
-
const
|
|
511
|
-
const versionUrl = `${JSR_API_URL}scopes/${scope}/packages/${pkgName}/versions/${version}`;
|
|
512
|
-
const packageUrl = `${JSR_API_URL}scopes/${scope}/packages/${pkgName}`;
|
|
537
|
+
const documents = documentsByComponent.get(component) || [];
|
|
513
538
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
539
|
+
if (documents.includes(urls.versionUrl)) {
|
|
540
|
+
let versionBody = jsrMetadataCache.get(urls.versionUrl);
|
|
541
|
+
if (!versionBody) {
|
|
542
|
+
const res =
|
|
543
|
+
prefetchedResponse(prefetched, urls.versionUrl) ||
|
|
544
|
+
(await gatedGet(urls.versionUrl, { responseType: "json" }));
|
|
545
|
+
versionBody = res.body;
|
|
546
|
+
jsrMetadataCache.set(urls.versionUrl, versionBody);
|
|
547
|
+
}
|
|
548
|
+
if (versionBody?.license && !component.license) {
|
|
549
|
+
component.license = versionBody.license;
|
|
550
|
+
}
|
|
524
551
|
}
|
|
525
552
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
553
|
+
if (documents.includes(urls.packageUrl)) {
|
|
554
|
+
let packageBody = jsrMetadataCache.get(urls.packageUrl);
|
|
555
|
+
if (!packageBody) {
|
|
556
|
+
const res =
|
|
557
|
+
prefetchedResponse(prefetched, urls.packageUrl) ||
|
|
558
|
+
(await gatedGet(urls.packageUrl, { responseType: "json" }));
|
|
559
|
+
packageBody = res.body;
|
|
560
|
+
jsrMetadataCache.set(urls.packageUrl, packageBody);
|
|
561
|
+
}
|
|
562
|
+
if (packageBody?.description && !component.description) {
|
|
563
|
+
component.description = packageBody.description;
|
|
564
|
+
}
|
|
565
|
+
const ghRepo = packageBody?.githubRepository;
|
|
566
|
+
if (ghRepo?.owner && ghRepo?.name) {
|
|
567
|
+
addVcsReference(
|
|
568
|
+
component,
|
|
569
|
+
`https://github.com/${ghRepo.owner}/${ghRepo.name}`,
|
|
570
|
+
);
|
|
571
|
+
}
|
|
543
572
|
}
|
|
544
573
|
} catch (_err) {
|
|
545
574
|
if (DEBUG_MODE) {
|
|
@@ -1034,11 +1063,9 @@ export async function parseDenoLock(lockFile, options = {}) {
|
|
|
1034
1063
|
JSR_NPM_REGISTRY_HOST,
|
|
1035
1064
|
);
|
|
1036
1065
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
readEnvironmentVariable("FETCH_LICENSE") === "true"
|
|
1041
|
-
) {
|
|
1066
|
+
// The shared metadata gate: FETCH_LICENSE and the provenance fetch that
|
|
1067
|
+
// --bom-audit turns on both reach the registries from here.
|
|
1068
|
+
if (shouldFetchPackageMetadata()) {
|
|
1042
1069
|
if (DEBUG_MODE) {
|
|
1043
1070
|
console.log(
|
|
1044
1071
|
`About to fetch registry metadata for ${pkgList.length} packages in parseDenoLock`,
|