@vltpkg/package-info 1.0.1 → 1.0.2

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 (2) hide show
  1. package/dist/index.js +16 -3
  2. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -505,7 +505,7 @@ export class PackageInfoClient {
505
505
  await clone(gitRemote, gitCommittish, dir, { spec: s });
506
506
  const { path } = gitSelectorParsed ?? {};
507
507
  const pkgDir = path !== undefined ? pathResolve(dir, path) : dir;
508
- return this.packageJson.read(pkgDir);
508
+ return this.#readExtracted(pkgDir, s, options);
509
509
  });
510
510
  }
511
511
  // fallthrough to remote
@@ -533,7 +533,7 @@ export class PackageInfoClient {
533
533
  throw this.#resolveError(s, options, 'tar unpack failed', { cause: er });
534
534
  }
535
535
  // return manifest with computed integrity
536
- const mani = this.packageJson.read(dir);
536
+ const mani = this.#readExtracted(dir, s, options);
537
537
  mani.dist = { integrity: computed };
538
538
  return mani;
539
539
  });
@@ -555,7 +555,7 @@ export class PackageInfoClient {
555
555
  catch (er) {
556
556
  throw this.#resolveError(s, options, 'tar unpack failed', { cause: er });
557
557
  }
558
- return this.packageJson.read(dir);
558
+ return this.#readExtracted(dir, s, options);
559
559
  });
560
560
  }
561
561
  case 'workspace': {
@@ -723,6 +723,19 @@ export class PackageInfoClient {
723
723
  }
724
724
  }
725
725
  }
726
+ /**
727
+ * Read the manifest out of a directory we cloned or unpacked. Failures are
728
+ * labeled with the spec, because the internal directory says nothing about
729
+ * which dependency is at fault.
730
+ */
731
+ #readExtracted(dir, spec, options) {
732
+ try {
733
+ return this.packageJson.read(dir);
734
+ }
735
+ catch (er) {
736
+ throw this.#resolveError(spec, options, 'invalid package manifest', { cause: er });
737
+ }
738
+ }
726
739
  async #tmpdir(fn) {
727
740
  const p = `package-info/${randomBytes(6).toString('hex')}`;
728
741
  const dir = xdg.runtime(p);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/package-info",
3
3
  "description": "Resolve and fetch package metadata and tarballs",
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,16 +13,16 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/error-cause": "1.0.1",
17
- "@vltpkg/git": "1.0.1",
18
- "@vltpkg/package-json": "1.0.1",
19
- "@vltpkg/pick-manifest": "1.0.1",
20
- "@vltpkg/registry-client": "1.0.1",
21
- "@vltpkg/spec": "1.0.1",
22
- "@vltpkg/tar": "1.0.1",
23
- "@vltpkg/types": "1.0.1",
24
- "@vltpkg/workspaces": "1.0.1",
25
- "@vltpkg/xdg": "1.0.1",
16
+ "@vltpkg/error-cause": "1.0.2",
17
+ "@vltpkg/git": "1.0.2",
18
+ "@vltpkg/package-json": "1.0.2",
19
+ "@vltpkg/pick-manifest": "1.0.2",
20
+ "@vltpkg/registry-client": "1.0.2",
21
+ "@vltpkg/spec": "1.0.2",
22
+ "@vltpkg/tar": "1.0.2",
23
+ "@vltpkg/types": "1.0.2",
24
+ "@vltpkg/workspaces": "1.0.2",
25
+ "@vltpkg/xdg": "1.0.2",
26
26
  "ssri": "^13.0.0",
27
27
  "tar": "^7.5.2"
28
28
  },
@@ -31,8 +31,8 @@
31
31
  "@types/node": "^22.19.2",
32
32
  "@types/pacote": "^11.1.8",
33
33
  "@vltpkg/benchmark": "0.0.0",
34
- "@vltpkg/cache-unzip": "1.0.1",
35
- "@vltpkg/vlt-json": "1.0.1",
34
+ "@vltpkg/cache-unzip": "1.0.2",
35
+ "@vltpkg/vlt-json": "1.0.2",
36
36
  "eslint": "^9.39.1",
37
37
  "pacote": "^21.0.4",
38
38
  "prettier": "^3.7.4",