@vltpkg/package-info 1.3.0 → 1.3.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.
- package/dist/index.js +36 -15
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -179,11 +179,12 @@ export class PackageInfoClient {
|
|
|
179
179
|
return this.#tarPoolPromise;
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* client does not use (see
|
|
185
|
-
* `--no-brotli-tarballs` is set.
|
|
186
|
-
*
|
|
182
|
+
* A version's Brotli (`.tar.br`) alternate: its absolute URL, plus its
|
|
183
|
+
* hash if the registry sent one. Returns undefined if the version has no
|
|
184
|
+
* alternate, if it has one this client does not use (see
|
|
185
|
+
* {@link brotliTarballUrl}), or if `--no-brotli-tarballs` is set.
|
|
186
|
+
* `dist.tarball` is already absolute by this point; see
|
|
187
|
+
* `absolutizeTarballs`.
|
|
187
188
|
*/
|
|
188
189
|
#brotliTarball(tarball, alternates) {
|
|
189
190
|
if (this.options['brotli-tarballs'] === false)
|
|
@@ -269,10 +270,17 @@ export class PackageInfoClient {
|
|
|
269
270
|
// below has to be told; gzip and raw tar are sniffed.
|
|
270
271
|
const format = tarballFormat(r.resolved);
|
|
271
272
|
// git tarballs keep the unpack path
|
|
272
|
-
const
|
|
273
|
-
integrityHex(r.integrity)
|
|
274
|
-
: undefined;
|
|
273
|
+
const storeOn = f.type === 'registry' && this.#storeLinker !== 'unpack';
|
|
275
274
|
const copy = this.#storeLinker === 'copy' || installScripts;
|
|
275
|
+
// If we already have a hash, that is the store key. Some
|
|
276
|
+
// tarballs arrive without one: a `.tar.br`, or anything a
|
|
277
|
+
// registry serves with no `dist.integrity`. For those, read the
|
|
278
|
+
// hash off the cache entry, which recorded it when the bytes
|
|
279
|
+
// were verified. Installs that do have a hash skip all of this,
|
|
280
|
+
// so a store hit still never builds a registry client.
|
|
281
|
+
const hex = !storeOn ? undefined
|
|
282
|
+
: r.integrity ? integrityHex(r.integrity)
|
|
283
|
+
: integrityHex((await this.getRegistryClient()).cachedIntegrity(r.resolved));
|
|
276
284
|
if (hex) {
|
|
277
285
|
if (debug.enabled && !this.#storeHitRateLogged) {
|
|
278
286
|
this.#storeHitRateLogged = true;
|
|
@@ -308,12 +316,13 @@ export class PackageInfoClient {
|
|
|
308
316
|
await pool.unpack(cached.body, target, format);
|
|
309
317
|
logRequest(r.resolved, 'cache');
|
|
310
318
|
r.integrity ??= cached.integrity;
|
|
311
|
-
//
|
|
312
|
-
// store miss here
|
|
313
|
-
//
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
|
|
319
|
+
// A warm install writes nothing to the cache, so queue the
|
|
320
|
+
// store miss here. Without this an existing cache would
|
|
321
|
+
// never catch up. Also queue a gzipped body that did not
|
|
322
|
+
// come from the store, so it gets un-gzipped. A brotli body
|
|
323
|
+
// is left alone: cache-unzip only handles gzip, and keeping
|
|
324
|
+
// it compressed keeps the cache small.
|
|
325
|
+
if (storeOn || cached.gzip) {
|
|
317
326
|
rc.queueForStore(cached.key, r.integrity);
|
|
318
327
|
}
|
|
319
328
|
return r;
|
|
@@ -1007,7 +1016,19 @@ export class PackageInfoClient {
|
|
|
1007
1016
|
// registry that advertised it always sends -- hence `required`.
|
|
1008
1017
|
const brotli = this.#brotliTarball(tarball, alternates);
|
|
1009
1018
|
const r = brotli ?
|
|
1010
|
-
{
|
|
1019
|
+
{
|
|
1020
|
+
resolved: brotli.tarball,
|
|
1021
|
+
spec,
|
|
1022
|
+
// Pin the alternate's own hash if the registry sent
|
|
1023
|
+
// one. That also means we can look the package up in
|
|
1024
|
+
// the global store before downloading it. If there is
|
|
1025
|
+
// no hash, the Repr-Digest header is the only check we
|
|
1026
|
+
// get, so require it instead of treating it as
|
|
1027
|
+
// optional.
|
|
1028
|
+
...(brotli.integrity ?
|
|
1029
|
+
{ integrity: brotli.integrity }
|
|
1030
|
+
: { digestRequired: true }),
|
|
1031
|
+
}
|
|
1011
1032
|
: { resolved: tarball, integrity, signatures, spec };
|
|
1012
1033
|
if (!brotli &&
|
|
1013
1034
|
!integrity &&
|
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.3.
|
|
4
|
+
"version": "1.3.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.3.
|
|
17
|
-
"@vltpkg/git": "1.3.
|
|
18
|
-
"@vltpkg/output": "1.3.
|
|
19
|
-
"@vltpkg/package-json": "1.3.
|
|
20
|
-
"@vltpkg/pick-manifest": "1.3.
|
|
21
|
-
"@vltpkg/registry-client": "1.3.
|
|
22
|
-
"@vltpkg/spec": "1.3.
|
|
23
|
-
"@vltpkg/tar": "1.3.
|
|
24
|
-
"@vltpkg/types": "1.3.
|
|
25
|
-
"@vltpkg/workspaces": "1.3.
|
|
26
|
-
"@vltpkg/xdg": "1.3.
|
|
16
|
+
"@vltpkg/error-cause": "1.3.1",
|
|
17
|
+
"@vltpkg/git": "1.3.1",
|
|
18
|
+
"@vltpkg/output": "1.3.1",
|
|
19
|
+
"@vltpkg/package-json": "1.3.1",
|
|
20
|
+
"@vltpkg/pick-manifest": "1.3.1",
|
|
21
|
+
"@vltpkg/registry-client": "1.3.1",
|
|
22
|
+
"@vltpkg/spec": "1.3.1",
|
|
23
|
+
"@vltpkg/tar": "1.3.1",
|
|
24
|
+
"@vltpkg/types": "1.3.1",
|
|
25
|
+
"@vltpkg/workspaces": "1.3.1",
|
|
26
|
+
"@vltpkg/xdg": "1.3.1",
|
|
27
27
|
"ssri": "^13.0.0",
|
|
28
28
|
"tar": "^7.5.2"
|
|
29
29
|
},
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@types/node": "^22.19.2",
|
|
33
33
|
"@types/pacote": "^11.1.8",
|
|
34
34
|
"@vltpkg/benchmark": "0.0.0",
|
|
35
|
-
"@vltpkg/cache-unzip": "1.3.
|
|
36
|
-
"@vltpkg/vlt-json": "1.3.
|
|
35
|
+
"@vltpkg/cache-unzip": "1.3.1",
|
|
36
|
+
"@vltpkg/vlt-json": "1.3.1",
|
|
37
37
|
"eslint": "^9.39.1",
|
|
38
38
|
"pacote": "^21.0.4",
|
|
39
39
|
"prettier": "^3.7.4",
|