@vltpkg/package-info 1.6.0 → 1.6.1

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 +21 -4
  2. package/package.json +14 -14
package/dist/index.js CHANGED
@@ -338,16 +338,24 @@ export class PackageInfoClient {
338
338
  spec = Spec.parse(spec, this.options);
339
339
  const { from = this.#projectRoot, integrity, resolved, fromLockfile = false, } = options;
340
340
  const f = spec.final;
341
+ // vlt <= 1.6.0 locked hosted git tarballs with the bare git remote
342
+ // as `resolved`, which can't be fetched
343
+ const url = (f.type === 'git' &&
344
+ f.remoteURL &&
345
+ resolved &&
346
+ !/^https?:\/\//.test(resolved)) ?
347
+ f.remoteURL
348
+ : resolved;
341
349
  // If the caller already provides both integrity and resolved
342
350
  // (from lockfile or prior resolution), skip re-resolving. A
343
351
  // `.tar.br` needs only the URL: its hash is not knowable before the
344
352
  // download, so the graph can never hand one over, and `Repr-Digest`
345
353
  // is what pins it -- `required`, so a registry that serves the
346
354
  // alternate unlabelled is rejected rather than trusted.
347
- const brotli = !!resolved && tarballFormat(resolved) === 'brotli';
348
- const r = resolved && (integrity || brotli) ?
355
+ const brotli = !!url && tarballFormat(url) === 'brotli';
356
+ const r = url && (integrity || brotli) ?
349
357
  {
350
- resolved,
358
+ resolved: url,
351
359
  integrity,
352
360
  spec,
353
361
  ...(brotli && !integrity ? { digestRequired: true } : {}),
@@ -395,9 +403,12 @@ export class PackageInfoClient {
395
403
  // hash off the cache entry, which recorded it when the bytes
396
404
  // were verified. Installs that do have a hash skip all of this,
397
405
  // so a store hit still never builds a registry client.
406
+ const cachedIntegrity = storeOn && !r.integrity ?
407
+ (await this.getRegistryClient()).cachedIntegrity(r.resolved)
408
+ : undefined;
398
409
  const hex = !storeOn ? undefined
399
410
  : r.integrity ? integrityHex(r.integrity)
400
- : integrityHex((await this.getRegistryClient()).cachedIntegrity(r.resolved));
411
+ : integrityHex(cachedIntegrity);
401
412
  if (hex) {
402
413
  if (debug.enabled && !this.#storeHitRateLogged) {
403
414
  this.#storeHitRateLogged = true;
@@ -409,6 +420,12 @@ export class PackageInfoClient {
409
420
  this.#storeHits[how]++;
410
421
  // a copy is no link: report it as a cache hit
411
422
  logRequest(r.resolved, how === 'copy' ? 'cache' : 'store');
423
+ // nothing pinned: the store was hit under the hash the
424
+ // registry client recorded when it fetched these bytes (a
425
+ // `.tar.br` checked against `Repr-Digest`, or a `.tgz` served
426
+ // with no `dist.integrity`), so the lockfile can pin it. same
427
+ // trust the cache-unpack path below puts in that label.
428
+ r.integrity ??= cachedIntegrity;
412
429
  return {
413
430
  ...r,
414
431
  manifest: index.manifest,
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.6.0",
4
+ "version": "1.6.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,17 +13,17 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/error-cause": "1.6.0",
17
- "@vltpkg/git": "1.6.0",
18
- "@vltpkg/output": "1.6.0",
19
- "@vltpkg/package-json": "1.6.0",
20
- "@vltpkg/pick-manifest": "1.6.0",
21
- "@vltpkg/registry-client": "1.6.0",
22
- "@vltpkg/spec": "1.6.0",
23
- "@vltpkg/tar": "1.6.0",
24
- "@vltpkg/types": "1.6.0",
25
- "@vltpkg/workspaces": "1.6.0",
26
- "@vltpkg/xdg": "1.6.0",
16
+ "@vltpkg/error-cause": "1.6.1",
17
+ "@vltpkg/git": "1.6.1",
18
+ "@vltpkg/output": "1.6.1",
19
+ "@vltpkg/package-json": "1.6.1",
20
+ "@vltpkg/pick-manifest": "1.6.1",
21
+ "@vltpkg/registry-client": "1.6.1",
22
+ "@vltpkg/spec": "1.6.1",
23
+ "@vltpkg/tar": "1.6.1",
24
+ "@vltpkg/types": "1.6.1",
25
+ "@vltpkg/workspaces": "1.6.1",
26
+ "@vltpkg/xdg": "1.6.1",
27
27
  "tar": "^7.5.2"
28
28
  },
29
29
  "devDependencies": {
@@ -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.6.0",
35
- "@vltpkg/vlt-json": "1.6.0",
34
+ "@vltpkg/cache-unzip": "1.6.1",
35
+ "@vltpkg/vlt-json": "1.6.1",
36
36
  "eslint": "^9.39.1",
37
37
  "pacote": "^21.0.4",
38
38
  "prettier": "^3.7.4",