@pnpm/deps.compliance.sbom 1100.0.4 → 1100.0.6

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.
@@ -1,4 +1,5 @@
1
1
  import type { LockfileObject } from '@pnpm/lockfile.types';
2
+ import type { Resolution } from '@pnpm/resolving.resolver-base';
2
3
  import type { DependenciesField, ProjectId, Registries } from '@pnpm/types';
3
4
  import type { SbomComponentType, SbomResult } from './types.js';
4
5
  export interface CollectSbomComponentsOptions {
@@ -21,3 +22,4 @@ export interface CollectSbomComponentsOptions {
21
22
  virtualStoreDirMaxLength?: number;
22
23
  }
23
24
  export declare function collectSbomComponents(opts: CollectSbomComponentsOptions): Promise<SbomResult>;
25
+ export declare function gitDownloadUrl(resolution: Resolution): string | undefined;
@@ -52,7 +52,7 @@ async function walkStep(step, parentPurl, depTypes, componentsMap, relationships
52
52
  return;
53
53
  const integrity = pkgSnapshot.resolution.integrity;
54
54
  const resolution = pkgSnapshotToResolution(depPath, pkgSnapshot, opts.registries);
55
- const tarballUrl = resolution.tarball;
55
+ const tarballUrl = resolution.tarball ?? gitDownloadUrl(resolution);
56
56
  let metadata = {};
57
57
  if (metadataOpts) {
58
58
  metadata = await getPkgMetadata(depPath, pkgSnapshot, opts.registries, metadataOpts);
@@ -72,4 +72,11 @@ async function walkStep(step, parentPurl, depTypes, componentsMap, relationships
72
72
  await walkStep(subStep, purl, depTypes, componentsMap, relationships, opts, metadataOpts);
73
73
  }));
74
74
  }
75
+ export function gitDownloadUrl(resolution) {
76
+ if (resolution.type !== 'git')
77
+ return undefined;
78
+ const needsGitPlusPrefix = resolution.repo.includes('://') && !resolution.repo.startsWith('git+');
79
+ const prefix = needsGitPlusPrefix ? 'git+' : '';
80
+ return `${prefix}${resolution.repo}#${resolution.commit}`;
81
+ }
75
82
  //# sourceMappingURL=collectComponents.js.map
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { collectSbomComponents, type CollectSbomComponentsOptions } from './collectComponents.js';
1
+ export { collectSbomComponents, type CollectSbomComponentsOptions, gitDownloadUrl } from './collectComponents.js';
2
2
  export { integrityToHashes } from './integrity.js';
3
3
  export { buildPurl, encodePurlName } from './purl.js';
4
4
  export { type CycloneDxOptions, serializeCycloneDx } from './serializeCycloneDx.js';
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { collectSbomComponents } from './collectComponents.js';
1
+ export { collectSbomComponents, gitDownloadUrl } from './collectComponents.js';
2
2
  export { integrityToHashes } from './integrity.js';
3
3
  export { buildPurl, encodePurlName } from './purl.js';
4
4
  export { serializeCycloneDx } from './serializeCycloneDx.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/deps.compliance.sbom",
3
- "version": "1100.0.4",
3
+ "version": "1100.0.6",
4
4
  "description": "Generate SBOM from pnpm lockfile",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -31,14 +31,15 @@
31
31
  "p-limit": "^7.1.0",
32
32
  "ssri": "13.0.1",
33
33
  "@pnpm/deps.compliance.license-resolver": "1100.0.0",
34
- "@pnpm/lockfile.detect-dep-types": "1100.0.2",
35
- "@pnpm/lockfile.types": "1100.0.2",
36
- "@pnpm/lockfile.utils": "1100.0.3",
37
- "@pnpm/pkg-manifest.reader": "1100.0.1",
38
- "@pnpm/lockfile.walker": "1100.0.2",
34
+ "@pnpm/lockfile.detect-dep-types": "1100.0.3",
35
+ "@pnpm/lockfile.types": "1100.0.3",
36
+ "@pnpm/lockfile.utils": "1100.0.4",
37
+ "@pnpm/lockfile.walker": "1100.0.3",
38
+ "@pnpm/pkg-manifest.reader": "1100.0.2",
39
+ "@pnpm/resolving.resolver-base": "1100.1.1",
39
40
  "@pnpm/store.index": "1100.0.0",
40
- "@pnpm/types": "1101.0.0",
41
- "@pnpm/store.pkg-finder": "1100.0.4"
41
+ "@pnpm/store.pkg-finder": "1100.0.5",
42
+ "@pnpm/types": "1101.0.0"
42
43
  },
43
44
  "peerDependencies": {
44
45
  "@pnpm/logger": ">=1001.0.0 <1002.0.0"
@@ -46,9 +47,9 @@
46
47
  "devDependencies": {
47
48
  "@jest/globals": "30.3.0",
48
49
  "@types/ssri": "^7.1.5",
49
- "@pnpm/deps.compliance.sbom": "1100.0.4",
50
+ "@pnpm/deps.compliance.sbom": "1100.0.6",
50
51
  "@pnpm/logger": "1100.0.0",
51
- "@pnpm/store.cafs": "1100.1.0"
52
+ "@pnpm/store.cafs": "1100.1.1"
52
53
  },
53
54
  "engines": {
54
55
  "node": ">=22.13"