@vzn/vx-lockfile 0.0.595 → 0.0.596

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx-lockfile",
3
- "version": "0.0.595",
3
+ "version": "0.0.596",
4
4
  "license": "MIT",
5
5
  "description": "Lockfile plugins for vx — pnpm(), bun(), npm(), yarn(): each keys every task on its project's own resolved dependency closure from the package manager's lockfile, so a lockfile change re-keys only the projects it reaches; --affected follows the same answer; `vx prune` cuts the workspace and the lockfile to a Docker subset.",
6
6
  "keywords": [
@@ -37,7 +37,7 @@
37
37
  "access": "public"
38
38
  },
39
39
  "peerDependencies": {
40
- "@vzn/vx": "^0.0.595"
40
+ "@vzn/vx": "^0.0.596"
41
41
  },
42
42
  "repository": {
43
43
  "type": "git",
package/src/pnpm.ts CHANGED
@@ -60,11 +60,9 @@ export function parseLockfile(text: string): Lockfile {
60
60
  // with "regenerate it", which regenerates the same two documents.
61
61
  const parsed: unknown = Bun.YAML.parse(text)
62
62
  const docs = (Array.isArray(parsed) ? parsed : [parsed]).filter((d) => d !== null)
63
- const doc = docs.at(-1) as Yaml | undefined
63
+ const doc = record(docs.at(-1))
64
64
  const leading = docs.slice(0, -1)
65
- if (doc === undefined || typeof doc !== 'object' || Array.isArray(doc)) {
66
- throw new Error('pnpm-lock.yaml: not a YAML document')
67
- }
65
+ if (doc === undefined) throw new Error('pnpm-lock.yaml: not a YAML document')
68
66
  const version = scalar(doc['lockfileVersion'])
69
67
  const major = Number.parseInt(version, 10)
70
68
  if (!Number.isFinite(major) || major < 5) {
package/src/prune.ts CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  type ProjectMeta,
26
26
  } from '@vzn/vx'
27
27
  import * as bunLock from './bun.js'
28
+ import { record } from './json.js'
28
29
  import * as npmLock from './npm.js'
29
30
  import * as pnpmLock from './pnpm.js'
30
31
  import * as yarnLock from './yarn.js'
@@ -317,9 +318,7 @@ async function namedFiles(root: string, manifest: Record<string, unknown>): Prom
317
318
  const p = path.join(root, file)
318
319
  if (!(await exists(p))) return {}
319
320
  const doc: unknown = Bun.YAML.parse(await Bun.file(p).text())
320
- return doc !== null && typeof doc === 'object' && !Array.isArray(doc)
321
- ? (doc as Record<string, unknown>)
322
- : {}
321
+ return record(doc) ?? {}
323
322
  }
324
323
  named.push(...values((await yaml('pnpm-workspace.yaml'))['patchedDependencies']))
325
324
  const yarnrc = await yaml('.yarnrc.yml')