@vltpkg/graph 1.3.6 → 1.3.7

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,6 +1,7 @@
1
1
  import { error } from '@vltpkg/error-cause';
2
2
  import { asDepID, splitDepID, splitExtra, } from '@vltpkg/dep-id/browser';
3
3
  import { getBooleanFlagsFromNum, getBuildStateFromNum, } from "./types.js";
4
+ import { tarballFormat } from '@vltpkg/types';
4
5
  export const loadNodes = (graph, nodes, options, actual, throwOnMissingManifest) => {
5
6
  const entries = Object.entries(nodes);
6
7
  const nodeCount = entries.length;
@@ -76,8 +77,15 @@ export const loadNodes = (graph, nodes, options, actual, throwOnMissingManifest)
76
77
  // node whose `resolved` the lockfile left out
77
78
  node.brotli = brotli;
78
79
  node.integrity = integrity ?? referenceNode?.integrity;
80
+ // `integrity` is the hash of the artifact `resolved` points at, so a
81
+ // reference url only stands in for an elided one when it names the
82
+ // kind of tarball the flag bit says the lockfile's own hash is for
83
+ const refResolved = referenceNode?.resolved;
84
+ const refResolvedUsable = !integrity ||
85
+ !refResolved ||
86
+ (tarballFormat(refResolved) === 'brotli') === brotli;
79
87
  node.resolved =
80
- type === 'remote' ? filepath : ((resolved ?? referenceNode?.resolved));
88
+ type === 'remote' ? filepath : ((resolved ?? (refResolvedUsable ? refResolved : undefined)));
81
89
  node.resolvedFromLockfile = !!(node.integrity && node.resolved);
82
90
  node.projectRoot = graph.projectRoot;
83
91
  if (!node.resolved)
package/dist/node.d.ts CHANGED
@@ -263,9 +263,13 @@ export declare class Node implements NodeLike {
263
263
  }
264
264
  /**
265
265
  * Copy the tarball metadata `to` is missing from another node for the
266
- * same package version. Lockfile provenance only carries over once both
267
- * `integrity` and `resolved` are set, since that pair is what makes it
268
- * usable without refetching.
266
+ * same package version. `integrity` is one artifact's hash, so it never
267
+ * crosses onto a node bound for the other kind of tarball: a node with
268
+ * no metadata of its own takes `from`'s kind along with it, one that
269
+ * already has a url or a hash only fills in what matches its own.
270
+ * Lockfile provenance only carries over once both `integrity` and
271
+ * `resolved` are set, since that pair is what makes it usable without
272
+ * refetching.
269
273
  */
270
274
  export declare const copyPackageMetadata: (to: Node, from: Node) => void;
271
275
  export declare const isNode: (value: unknown) => value is Node;
package/dist/node.js CHANGED
@@ -483,11 +483,21 @@ export class Node {
483
483
  }
484
484
  /**
485
485
  * Copy the tarball metadata `to` is missing from another node for the
486
- * same package version. Lockfile provenance only carries over once both
487
- * `integrity` and `resolved` are set, since that pair is what makes it
488
- * usable without refetching.
486
+ * same package version. `integrity` is one artifact's hash, so it never
487
+ * crosses onto a node bound for the other kind of tarball: a node with
488
+ * no metadata of its own takes `from`'s kind along with it, one that
489
+ * already has a url or a hash only fills in what matches its own.
490
+ * Lockfile provenance only carries over once both `integrity` and
491
+ * `resolved` are set, since that pair is what makes it usable without
492
+ * refetching.
489
493
  */
490
494
  export const copyPackageMetadata = (to, from) => {
495
+ if (!from.integrity && !from.resolved)
496
+ return;
497
+ if (!to.integrity && !to.resolved)
498
+ to.brotli = from.brotli;
499
+ if (to.brotli !== from.brotli)
500
+ return;
491
501
  to.integrity ??= from.integrity;
492
502
  to.resolved ??= from.resolved;
493
503
  if (from.resolvedFromLockfile && to.integrity && to.resolved) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/graph",
3
3
  "description": "A library that helps understanding & expressing what happens on an install",
4
- "version": "1.3.6",
4
+ "version": "1.3.7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,26 +13,26 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/cmd-shim": "1.3.6",
17
- "@vltpkg/dep-id": "1.3.6",
18
- "@vltpkg/dss-breadcrumb": "1.3.6",
19
- "@vltpkg/error-cause": "1.3.6",
20
- "@vltpkg/fast-split": "1.3.6",
21
- "@vltpkg/graph-run": "1.3.6",
22
- "@vltpkg/init": "1.3.6",
23
- "@vltpkg/output": "1.3.6",
24
- "@vltpkg/package-info": "1.3.6",
25
- "@vltpkg/package-json": "1.3.6",
26
- "@vltpkg/pick-manifest": "1.3.6",
27
- "@vltpkg/query": "1.3.6",
28
- "@vltpkg/rollback-remove": "1.3.6",
29
- "@vltpkg/run": "1.3.6",
30
- "@vltpkg/satisfies": "1.3.6",
31
- "@vltpkg/security-archive": "1.3.6",
32
- "@vltpkg/spec": "1.3.6",
33
- "@vltpkg/types": "1.3.6",
34
- "@vltpkg/vlt-json": "1.3.6",
35
- "@vltpkg/workspaces": "1.3.6",
16
+ "@vltpkg/cmd-shim": "1.3.7",
17
+ "@vltpkg/dep-id": "1.3.7",
18
+ "@vltpkg/dss-breadcrumb": "1.3.7",
19
+ "@vltpkg/error-cause": "1.3.7",
20
+ "@vltpkg/fast-split": "1.3.7",
21
+ "@vltpkg/graph-run": "1.3.7",
22
+ "@vltpkg/init": "1.3.7",
23
+ "@vltpkg/output": "1.3.7",
24
+ "@vltpkg/package-info": "1.3.7",
25
+ "@vltpkg/package-json": "1.3.7",
26
+ "@vltpkg/pick-manifest": "1.3.7",
27
+ "@vltpkg/query": "1.3.7",
28
+ "@vltpkg/rollback-remove": "1.3.7",
29
+ "@vltpkg/run": "1.3.7",
30
+ "@vltpkg/satisfies": "1.3.7",
31
+ "@vltpkg/security-archive": "1.3.7",
32
+ "@vltpkg/spec": "1.3.7",
33
+ "@vltpkg/types": "1.3.7",
34
+ "@vltpkg/vlt-json": "1.3.7",
35
+ "@vltpkg/workspaces": "1.3.7",
36
36
  "path-scurry": "^2.0.1",
37
37
  "promise-call-limit": "^3.0.2"
38
38
  },