@cyclonedx/cdxgen 11.4.1 → 11.4.3

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.
Files changed (57) hide show
  1. package/README.md +4 -1
  2. package/bin/cdxgen.js +32 -9
  3. package/bin/evinse.js +2 -0
  4. package/bin/repl.js +12 -4
  5. package/bin/verify.js +2 -0
  6. package/lib/cli/index.js +67 -57
  7. package/lib/evinser/evinser.js +21 -19
  8. package/lib/evinser/evinser.test.js +2 -2
  9. package/lib/evinser/swiftsem.js +1 -0
  10. package/lib/evinser/swiftsem.test.js +2 -2
  11. package/lib/helpers/analyzer.js +5 -4
  12. package/lib/helpers/cbomutils.js +2 -0
  13. package/lib/helpers/db.js +1 -0
  14. package/lib/helpers/display.js +1 -0
  15. package/lib/helpers/display.test.js +2 -0
  16. package/lib/helpers/envcontext.js +9 -7
  17. package/lib/helpers/envcontext.test.js +3 -1
  18. package/lib/helpers/logger.js +70 -10
  19. package/lib/helpers/protobom.js +29 -16
  20. package/lib/helpers/protobom.test.js +4 -1
  21. package/lib/helpers/utils.js +216 -102
  22. package/lib/helpers/utils.test.js +40 -10
  23. package/lib/helpers/validator.js +5 -5
  24. package/lib/managers/binary.js +17 -15
  25. package/lib/managers/docker.js +33 -31
  26. package/lib/managers/docker.test.js +2 -0
  27. package/lib/managers/oci.js +2 -1
  28. package/lib/managers/piptree.js +1 -0
  29. package/lib/server/server.js +90 -27
  30. package/lib/server/server.test.js +126 -0
  31. package/lib/stages/postgen/annotator.js +1 -0
  32. package/lib/stages/postgen/annotator.test.js +2 -2
  33. package/lib/stages/postgen/postgen.js +14 -6
  34. package/lib/stages/postgen/postgen.test.js +3 -2
  35. package/lib/stages/pregen/pregen.js +4 -3
  36. package/package.json +12 -11
  37. package/types/lib/cli/index.d.ts.map +1 -1
  38. package/types/lib/evinser/swiftsem.d.ts.map +1 -1
  39. package/types/lib/helpers/analyzer.d.ts.map +1 -1
  40. package/types/lib/helpers/cbomutils.d.ts.map +1 -1
  41. package/types/lib/helpers/db.d.ts.map +1 -1
  42. package/types/lib/helpers/display.d.ts.map +1 -1
  43. package/types/lib/helpers/envcontext.d.ts.map +1 -1
  44. package/types/lib/helpers/logger.d.ts +9 -0
  45. package/types/lib/helpers/logger.d.ts.map +1 -1
  46. package/types/lib/helpers/protobom.d.ts.map +1 -1
  47. package/types/lib/helpers/utils.d.ts +6 -3
  48. package/types/lib/helpers/utils.d.ts.map +1 -1
  49. package/types/lib/managers/binary.d.ts.map +1 -1
  50. package/types/lib/managers/docker.d.ts.map +1 -1
  51. package/types/lib/managers/oci.d.ts.map +1 -1
  52. package/types/lib/managers/piptree.d.ts.map +1 -1
  53. package/types/lib/server/server.d.ts +11 -0
  54. package/types/lib/server/server.d.ts.map +1 -1
  55. package/types/lib/stages/postgen/annotator.d.ts.map +1 -1
  56. package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
  57. package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
@@ -1,9 +1,11 @@
1
1
  import { Buffer } from "node:buffer";
2
2
  import { readFileSync } from "node:fs";
3
3
  import path from "node:path";
4
+
4
5
  import { afterAll, beforeAll, describe, expect, test } from "@jest/globals";
5
6
  import { parse } from "ssri";
6
7
  import { parse as loadYaml } from "yaml";
8
+
7
9
  import {
8
10
  buildObjectForCocoaPod,
9
11
  buildObjectForGradleModule,
@@ -11,12 +13,10 @@ import {
11
13
  findLicenseId,
12
14
  getCratesMetadata,
13
15
  getDartMetadata,
14
- getGoPkgLicense,
15
16
  getLicenses,
16
17
  getMvnMetadata,
17
18
  getNugetMetadata,
18
19
  getPyMetadata,
19
- getRepoLicense,
20
20
  guessPypiMatchingVersion,
21
21
  hasAnyProjectType,
22
22
  isPackageManagerAllowed,
@@ -55,11 +55,11 @@ import {
55
55
  parseGoListDep,
56
56
  parseGoModData,
57
57
  parseGoModGraph,
58
- parseGoModWhy,
59
58
  parseGoModulesTxt,
60
- parseGoVersionData,
59
+ parseGoModWhy,
61
60
  parseGopkgData,
62
61
  parseGosumData,
62
+ parseGoVersionData,
63
63
  parseGradleDep,
64
64
  parseGradleProjects,
65
65
  parseGradleProperties,
@@ -2475,19 +2475,17 @@ test("parse github actions workflow data", () => {
2475
2475
  readFileSync("./.github/workflows/nodejs.yml", { encoding: "utf-8" }),
2476
2476
  );
2477
2477
  expect(dep_list.length).toEqual(8);
2478
- expect(dep_list[0]).toEqual({
2478
+ expect(dep_list[0]).toMatchObject({
2479
2479
  group: "actions",
2480
2480
  name: "checkout",
2481
- version: "v4",
2482
2481
  });
2483
2482
  dep_list = parseGitHubWorkflowData(
2484
2483
  readFileSync("./.github/workflows/repotests.yml", { encoding: "utf-8" }),
2485
2484
  );
2486
2485
  expect(dep_list.length).toEqual(13);
2487
- expect(dep_list[0]).toEqual({
2486
+ expect(dep_list[0]).toMatchObject({
2488
2487
  group: "actions",
2489
2488
  name: "checkout",
2490
- version: "v4",
2491
2489
  });
2492
2490
  });
2493
2491
 
@@ -3806,8 +3804,8 @@ test("parsePnpmLock", async () => {
3806
3804
  expect(parsedList.dependenciesList).toHaveLength(462);
3807
3805
  expect(parsedList.pkgList.filter((pkg) => !pkg.scope)).toHaveLength(3);
3808
3806
  parsedList = await parsePnpmLock("./pnpm-lock.yaml");
3809
- expect(parsedList.pkgList.length).toEqual(591);
3810
- expect(parsedList.dependenciesList.length).toEqual(591);
3807
+ expect(parsedList.pkgList.length).toEqual(593);
3808
+ expect(parsedList.dependenciesList.length).toEqual(593);
3811
3809
  expect(parsedList.pkgList[0]).toEqual({
3812
3810
  group: "@ampproject",
3813
3811
  name: "remapping",
@@ -4537,6 +4535,23 @@ test("parseGemfileLockData", async () => {
4537
4535
  expect(retMap.pkgList.length).toEqual(139);
4538
4536
  expect(retMap.rootList.length).toEqual(22);
4539
4537
  expect(retMap.dependenciesList.length).toEqual(139);
4538
+ retMap = await parseGemfileLockData(
4539
+ readFileSync("./test/data/Gemfile-opt.lock", { encoding: "utf-8" }),
4540
+ "./test/data/Gemfile-opt.lock",
4541
+ );
4542
+ expect(retMap.pkgList.length).toEqual(37);
4543
+ expect(retMap.rootList.length).toEqual(8);
4544
+ expect(retMap.rootList).toEqual([
4545
+ "pkg:gem/http_parser.rb@0.8.0",
4546
+ "pkg:gem/jekyll@4.3.4",
4547
+ "pkg:gem/jekyll-feed@0.17.0",
4548
+ "pkg:gem/jekyll-readme-index@0.3.0",
4549
+ "pkg:gem/tzinfo@2.0.6",
4550
+ "pkg:gem/tzinfo-data",
4551
+ "pkg:gem/wdm",
4552
+ "pkg:gem/webrick@1.8.2",
4553
+ ]);
4554
+ expect(retMap.dependenciesList.length).toEqual(37);
4540
4555
  });
4541
4556
 
4542
4557
  test("toGemModuleName", () => {
@@ -5772,6 +5787,19 @@ test("parsePackageJsonName tests", () => {
5772
5787
  projectName: null,
5773
5788
  scope: "@babel",
5774
5789
  });
5790
+ expect(() => parsePackageJsonName(null)).not.toThrow();
5791
+ expect(parsePackageJsonName(null)).toEqual({
5792
+ fullName: "",
5793
+ moduleName: "",
5794
+ projectName: "",
5795
+ scope: null,
5796
+ });
5797
+ expect(parsePackageJsonName(undefined)).toEqual({
5798
+ fullName: "",
5799
+ moduleName: "",
5800
+ projectName: "",
5801
+ scope: null,
5802
+ });
5775
5803
  });
5776
5804
 
5777
5805
  test("parseDot tests", () => {
@@ -5869,6 +5897,7 @@ test("parseMakeDFile tests", () => {
5869
5897
  });
5870
5898
  });
5871
5899
 
5900
+ // biome-ignore-start lint/suspicious/noTemplateCurlyInString: This is a unit test
5872
5901
  test.each([
5873
5902
  ["", false],
5874
5903
  ["git@gitlab.com:behat-chrome/chrome-mink-driver.git", false],
@@ -5893,6 +5922,7 @@ test.each([
5893
5922
  ])("isValidIriReference tests: %s", (url, isValid) => {
5894
5923
  expect(isValidIriReference(url)).toBe(isValid);
5895
5924
  });
5925
+ // biome-ignore-end lint/suspicious/noTemplateCurlyInString: This is a unit test
5896
5926
 
5897
5927
  test("hasAnyProjectType tests", () => {
5898
5928
  expect(
@@ -1,12 +1,12 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
+
3
4
  import Ajv from "ajv";
4
5
  import addFormats from "ajv-formats";
5
6
  import { PackageURL } from "packageurl-js";
6
- import { DEBUG_MODE, dirNameStr, isPartialTree } from "./utils.js";
7
7
 
8
- import { URL } from "node:url";
9
8
  import { thoughtLog } from "./logger.js";
9
+ import { DEBUG_MODE, dirNameStr, isPartialTree } from "./utils.js";
10
10
 
11
11
  const dirName = dirNameStr;
12
12
 
@@ -185,7 +185,7 @@ export const validatePurls = (bomJson) => {
185
185
  `purl does not include namespace but includes encoded slash in name for npm type. ${comp.purl}`,
186
186
  );
187
187
  }
188
- } catch (ex) {
188
+ } catch (_ex) {
189
189
  errorList.push(`Invalid purl ${comp.purl}`);
190
190
  }
191
191
  }
@@ -263,7 +263,7 @@ export const validateRefs = (bomJson) => {
263
263
  try {
264
264
  const purlObj = PackageURL.fromString(dep.ref);
265
265
  parentPurlType = purlObj.type;
266
- } catch (e) {
266
+ } catch (_e) {
267
267
  // pass
268
268
  }
269
269
  if (
@@ -287,7 +287,7 @@ export const validateRefs = (bomJson) => {
287
287
  try {
288
288
  const purlObj = PackageURL.fromString(don);
289
289
  childPurlType = purlObj.type;
290
- } catch (e) {
290
+ } catch (_e) {
291
291
  // pass
292
292
  }
293
293
  if (
@@ -10,22 +10,24 @@ import {
10
10
  import { arch as _arch, platform as _platform, homedir } from "node:os";
11
11
  import { basename, delimiter, dirname, join, resolve } from "node:path";
12
12
  import process from "node:process";
13
+
13
14
  import { PackageURL } from "packageurl-js";
15
+
14
16
  import {
15
- DEBUG_MODE,
16
- MAX_BUFFER,
17
- TIMEOUT_MS,
18
17
  adjustLicenseInformation,
19
18
  collectExecutables,
20
19
  collectSharedLibs,
20
+ DEBUG_MODE,
21
21
  dirNameStr,
22
22
  extractPathEnv,
23
23
  findLicenseId,
24
24
  getTmpDir,
25
25
  isSpdxLicenseExpression,
26
+ MAX_BUFFER,
26
27
  multiChecksumFile,
27
28
  safeMkdirSync,
28
29
  safeSpawnSync,
30
+ TIMEOUT_MS,
29
31
  } from "../helpers/utils.js";
30
32
 
31
33
  const dirName = dirNameStr;
@@ -444,7 +446,7 @@ export async function getOSPackages(src, imageConfig) {
444
446
  try {
445
447
  safeMkdirSync(join(trivyCacheDir, "db"), { recursive: true });
446
448
  safeMkdirSync(join(trivyCacheDir, "java-db"), { recursive: true });
447
- } catch (err) {
449
+ } catch (_err) {
448
450
  // ignore errors
449
451
  }
450
452
  if (existsSync(src)) {
@@ -492,7 +494,7 @@ export async function getOSPackages(src, imageConfig) {
492
494
  encoding: "utf-8",
493
495
  }),
494
496
  );
495
- } catch (e) {
497
+ } catch (_e) {
496
498
  // ignore errors
497
499
  }
498
500
  // Clean up
@@ -505,7 +507,7 @@ export async function getOSPackages(src, imageConfig) {
505
507
  }
506
508
  }
507
509
  const osReleaseData = {};
508
- let osReleaseFile = undefined;
510
+ let osReleaseFile;
509
511
  // Let's try to read the os-release file from various locations
510
512
  if (existsSync(join(src, "etc", "os-release"))) {
511
513
  osReleaseFile = join(src, "etc", "os-release");
@@ -596,7 +598,7 @@ export async function getOSPackages(src, imageConfig) {
596
598
  // Fix the group
597
599
  let group = dirname(comp.name);
598
600
  const name = basename(comp.name);
599
- let purlObj = undefined;
601
+ let purlObj;
600
602
  if (group === ".") {
601
603
  group = "";
602
604
  }
@@ -681,7 +683,7 @@ export async function getOSPackages(src, imageConfig) {
681
683
  ).toString();
682
684
  comp["bom-ref"] = decodeURIComponent(comp.purl);
683
685
  }
684
- } catch (err) {
686
+ } catch (_err) {
685
687
  // continue regardless of error
686
688
  }
687
689
  }
@@ -752,8 +754,8 @@ export async function getOSPackages(src, imageConfig) {
752
754
  }
753
755
  }
754
756
  const compProperties = comp.properties;
755
- let srcName = undefined;
756
- let srcVersion = undefined;
757
+ let srcName;
758
+ let srcVersion;
757
759
  if (compProperties && Array.isArray(compProperties)) {
758
760
  for (const aprop of compProperties) {
759
761
  if (aprop.name.endsWith("SrcName")) {
@@ -895,12 +897,12 @@ const retrieveDependencies = (tmpDependencies, origBomRef, comp) => {
895
897
  }
896
898
  }
897
899
  dependsOn.add(decodeURIComponent(tmpPurl.toString()));
898
- } catch (e) {
900
+ } catch (_e) {
899
901
  // ignore
900
902
  }
901
903
  });
902
904
  return { ref: comp["bom-ref"], dependsOn: Array.from(dependsOn).sort() };
903
- } catch (e) {
905
+ } catch (_e) {
904
906
  // ignore
905
907
  }
906
908
  return undefined;
@@ -943,7 +945,7 @@ export function executeOsQuery(query) {
943
945
  if (cmdOutput !== "") {
944
946
  try {
945
947
  return JSON.parse(cmdOutput);
946
- } catch (err) {
948
+ } catch (_err) {
947
949
  // ignore
948
950
  if (DEBUG_MODE) {
949
951
  console.log("Unable to parse the output from query", query);
@@ -1060,7 +1062,7 @@ async function fileComponents(basePath, fileList, fileType) {
1060
1062
  { alg: "MD5", content: hashValues["md5"] },
1061
1063
  { alg: "SHA-1", content: hashValues["sha1"] },
1062
1064
  ];
1063
- } catch (e) {
1065
+ } catch (_e) {
1064
1066
  // ignore
1065
1067
  }
1066
1068
  // Collect methods returns relative paths from the extracted directory.
@@ -1081,7 +1083,7 @@ async function fileComponents(basePath, fileList, fileType) {
1081
1083
  isSetuid = !!(mode & 0o4000);
1082
1084
  isSetgid = !!(mode & 0o2000);
1083
1085
  isSticky = !!(mode & 0o1000);
1084
- } catch (e) {
1086
+ } catch (_e) {
1085
1087
  // ignore
1086
1088
  }
1087
1089
  const properties = [{ name: "SrcFile", value: f }];
@@ -3,8 +3,8 @@ import {
3
3
  createReadStream,
4
4
  lstatSync,
5
5
  mkdtempSync,
6
- readFileSync,
7
6
  readdirSync,
7
+ readFileSync,
8
8
  rmSync,
9
9
  statSync,
10
10
  } from "node:fs";
@@ -13,18 +13,20 @@ import { basename, join, resolve, win32 } from "node:path";
13
13
  import process from "node:process";
14
14
  import stream from "node:stream/promises";
15
15
  import { URL } from "node:url";
16
+
16
17
  import { globSync } from "glob";
17
18
  import got from "got";
18
19
  import { x } from "tar";
20
+
19
21
  import {
20
22
  DEBUG_MODE,
21
- TIMEOUT_MS,
22
23
  extractPathEnv,
23
24
  getAllFiles,
24
25
  getTmpDir,
25
26
  safeExistsSync,
26
27
  safeMkdirSync,
27
28
  safeSpawnSync,
29
+ TIMEOUT_MS,
28
30
  } from "../helpers/utils.js";
29
31
 
30
32
  export const isWin = _platform() === "win32";
@@ -40,7 +42,7 @@ if (NON_STRICT_TAR_EXTRACT) {
40
42
  );
41
43
  }
42
44
 
43
- let dockerConn = undefined;
45
+ let dockerConn;
44
46
  let isPodman = false;
45
47
  let isPodmanRootless = true;
46
48
  let isDockerRootless = false;
@@ -48,8 +50,8 @@ let isDockerRootless = false;
48
50
  let isContainerd = !!process.env.CONTAINERD_ADDRESS;
49
51
  const WIN_LOCAL_TLS = "http://localhost:2375";
50
52
  let isWinLocalTLS = false;
51
- let isNerdctl = undefined;
52
- let isColima = undefined;
53
+ let isNerdctl;
54
+ let isColima;
53
55
 
54
56
  if (
55
57
  !process.env.DOCKER_HOST &&
@@ -176,7 +178,7 @@ export const getDirs = (dirPath, dirName, hidden = false, recurse = true) => {
176
178
  follow: false,
177
179
  dot: hidden,
178
180
  });
179
- } catch (err) {
181
+ } catch (_err) {
180
182
  return [];
181
183
  }
182
184
  };
@@ -192,7 +194,7 @@ function getDirectories(srcpath) {
192
194
  .filter((path) => {
193
195
  try {
194
196
  return statSync(path).isDirectory();
195
- } catch (e) {
197
+ } catch (_e) {
196
198
  return false;
197
199
  }
198
200
  });
@@ -212,7 +214,7 @@ export const getOnlyDirs = (srcpath, dirName) => {
212
214
  return getOnlyDirs(p, dirName);
213
215
  }
214
216
  }
215
- } catch (err) {
217
+ } catch (_err) {
216
218
  // ignore
217
219
  }
218
220
  })
@@ -326,7 +328,7 @@ const getDefaultOptions = (forRegistry) => {
326
328
  }
327
329
  }
328
330
  }
329
- } catch (err) {
331
+ } catch (_err) {
330
332
  // pass
331
333
  }
332
334
  }
@@ -424,7 +426,7 @@ export const getConnection = async (options, forRegistry) => {
424
426
  );
425
427
  }
426
428
  }
427
- } catch (err) {
429
+ } catch (_err) {
428
430
  opts.prefixUrl = `http://unix:${homedir()}/.docker/run/docker.sock:`;
429
431
  try {
430
432
  await got.get("_ping", opts);
@@ -434,7 +436,7 @@ export const getConnection = async (options, forRegistry) => {
434
436
  console.log("Docker service in rootless mode detected.");
435
437
  }
436
438
  return dockerConn;
437
- } catch (err) {
439
+ } catch (_err) {
438
440
  // ignore
439
441
  }
440
442
  try {
@@ -458,7 +460,7 @@ export const getConnection = async (options, forRegistry) => {
458
460
  );
459
461
  }
460
462
  }
461
- } catch (err) {
463
+ } catch (_err) {
462
464
  try {
463
465
  opts.prefixUrl = opts.podmanPrefixUrl;
464
466
  await got.get("libpod/_ping", opts);
@@ -468,7 +470,7 @@ export const getConnection = async (options, forRegistry) => {
468
470
  console.log(
469
471
  "Podman in root mode detected. Consider switching to rootless mode to improve security. See https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md",
470
472
  );
471
- } catch (err) {
473
+ } catch (_err) {
472
474
  if (_platform() === "win32") {
473
475
  console.warn(
474
476
  "Ensure Docker for Desktop is running as an administrator with 'Exposing daemon on TCP without TLS' setting turned on.",
@@ -634,8 +636,8 @@ const needsCliFallback = () => {
634
636
  * Method to get image to the local registry by pulling from the remote if required
635
637
  */
636
638
  export const getImage = async (fullImageName) => {
637
- let localData = undefined;
638
- let pullData = undefined;
639
+ let localData;
640
+ let pullData;
639
641
  const { registry, repo, tag, digest } = parseImageName(fullImageName);
640
642
  const repoWithTag =
641
643
  registry && registry !== DOCKER_HUB_REGISTRY
@@ -672,7 +674,7 @@ export const getImage = async (fullImageName) => {
672
674
  needsPull = false;
673
675
  break;
674
676
  }
675
- } catch (err) {
677
+ } catch (_err) {
676
678
  // continue regardless of error
677
679
  }
678
680
  }
@@ -712,7 +714,7 @@ export const getImage = async (fullImageName) => {
712
714
  }
713
715
  return inspectData;
714
716
  }
715
- } catch (err) {
717
+ } catch (_err) {
716
718
  // continue regardless of error
717
719
  }
718
720
  }
@@ -725,12 +727,12 @@ export const getImage = async (fullImageName) => {
725
727
  if (localData) {
726
728
  return localData;
727
729
  }
728
- } catch (err) {
730
+ } catch (_err) {
729
731
  // ignore
730
732
  }
731
733
  try {
732
734
  localData = await makeRequest(`images/${repo}/json`, "GET", registry);
733
- } catch (err) {
735
+ } catch (_err) {
734
736
  try {
735
737
  localData = await makeRequest(
736
738
  `images/${fullImageName}/json`,
@@ -740,7 +742,7 @@ export const getImage = async (fullImageName) => {
740
742
  if (localData) {
741
743
  return localData;
742
744
  }
743
- } catch (err) {
745
+ } catch (_err) {
744
746
  // ignore
745
747
  }
746
748
  if (DEBUG_MODE) {
@@ -768,7 +770,7 @@ export const getImage = async (fullImageName) => {
768
770
  );
769
771
  return undefined;
770
772
  }
771
- } catch (err) {
773
+ } catch (_err) {
772
774
  try {
773
775
  if (DEBUG_MODE) {
774
776
  console.log(`Re-trying the pull with the name ${repoWithTag}.`);
@@ -778,7 +780,7 @@ export const getImage = async (fullImageName) => {
778
780
  "POST",
779
781
  registry,
780
782
  );
781
- } catch (err) {
783
+ } catch (_err) {
782
784
  // continue regardless of error
783
785
  }
784
786
  }
@@ -794,7 +796,7 @@ export const getImage = async (fullImageName) => {
794
796
  if (localData) {
795
797
  return localData;
796
798
  }
797
- } catch (err) {
799
+ } catch (_err) {
798
800
  try {
799
801
  if (DEBUG_MODE) {
800
802
  console.log(`Trying with ${repo}`);
@@ -803,7 +805,7 @@ export const getImage = async (fullImageName) => {
803
805
  if (localData) {
804
806
  return localData;
805
807
  }
806
- } catch (err) {
808
+ } catch (_err) {
807
809
  // continue regardless of error
808
810
  }
809
811
  try {
@@ -815,7 +817,7 @@ export const getImage = async (fullImageName) => {
815
817
  "GET",
816
818
  registry,
817
819
  );
818
- } catch (err) {
820
+ } catch (_err) {
819
821
  // continue regardless of error
820
822
  }
821
823
  }
@@ -1005,7 +1007,7 @@ export const exportArchive = async (fullImageName, options = {}) => {
1005
1007
  }
1006
1008
  console.log(`Unable to extract image archive to ${tempDir}`);
1007
1009
  options.failOnError && process.exit(1);
1008
- } catch (err) {
1010
+ } catch (_err) {
1009
1011
  // ignore
1010
1012
  options.failOnError && process.exit(1);
1011
1013
  }
@@ -1061,7 +1063,7 @@ export const extractFromManifest = async (
1061
1063
  );
1062
1064
  continue;
1063
1065
  }
1064
- } catch (e) {
1066
+ } catch (_e) {
1065
1067
  console.log(`Skipping layer ${layer} since it is not a readable file.`);
1066
1068
  continue;
1067
1069
  }
@@ -1100,7 +1102,7 @@ export const extractFromManifest = async (
1100
1102
  lastWorkingDir = lastLayerConfig.config?.WorkingDir
1101
1103
  ? join(allLayersExplodedDir, lastLayerConfig.config.WorkingDir)
1102
1104
  : "";
1103
- } catch (err) {
1105
+ } catch (_err) {
1104
1106
  options.failOnError && process.exit(1);
1105
1107
  }
1106
1108
  }
@@ -1210,7 +1212,7 @@ export const exportImage = async (fullImageName, options) => {
1210
1212
  onReadEntry: handleAbsolutePath,
1211
1213
  }),
1212
1214
  );
1213
- } catch (err) {
1215
+ } catch (_err) {
1214
1216
  if (localData?.Id) {
1215
1217
  console.log(`Retrying with ${localData.Id}`);
1216
1218
  try {
@@ -1232,7 +1234,7 @@ export const exportImage = async (fullImageName, options) => {
1232
1234
  onReadEntry: handleAbsolutePath,
1233
1235
  }),
1234
1236
  );
1235
- } catch (err) {
1237
+ } catch (_err) {
1236
1238
  // ignore
1237
1239
  }
1238
1240
  }
@@ -1422,7 +1424,7 @@ export const getCredsFromHelper = (exeSuffix, serverAddress) => {
1422
1424
  );
1423
1425
  registry_auth_keys[serverAddress] = authKey;
1424
1426
  return authKey;
1425
- } catch (err) {
1427
+ } catch (_err) {
1426
1428
  return undefined;
1427
1429
  }
1428
1430
  }
@@ -1,5 +1,7 @@
1
1
  import process from "node:process";
2
+
2
3
  import { beforeEach, describe, expect, test } from "@jest/globals";
4
+
3
5
  import {
4
6
  addSkippedSrcFiles,
5
7
  exportImage,
@@ -1,10 +1,11 @@
1
1
  import { Buffer } from "node:buffer";
2
2
  import fs from "node:fs";
3
+
3
4
  import {
4
- MAX_BUFFER,
5
5
  getAllFiles,
6
6
  getTmpDir,
7
7
  isWin,
8
+ MAX_BUFFER,
8
9
  safeSpawnSync,
9
10
  } from "../helpers/utils.js";
10
11
 
@@ -12,6 +12,7 @@ import {
12
12
  writeFileSync,
13
13
  } from "node:fs";
14
14
  import { delimiter, join } from "node:path";
15
+
15
16
  import { getTmpDir, safeSpawnSync } from "../helpers/utils.js";
16
17
 
17
18
  const PIP_TREE_PLUGIN_CONTENT = `