@vzn/vx 0.0.243 → 0.0.244

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",
3
- "version": "0.0.243",
3
+ "version": "0.0.244",
4
4
  "description": "A fast, correct task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,10 +17,10 @@
17
17
  "node": ">=18"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@vzn/vx-linux-x64": "0.0.243",
21
- "@vzn/vx-linux-arm64": "0.0.243",
22
- "@vzn/vx-darwin-x64": "0.0.243",
23
- "@vzn/vx-darwin-arm64": "0.0.243"
20
+ "@vzn/vx-linux-x64": "0.0.244",
21
+ "@vzn/vx-linux-arm64": "0.0.244",
22
+ "@vzn/vx-darwin-x64": "0.0.244",
23
+ "@vzn/vx-darwin-arm64": "0.0.244"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -21,7 +21,7 @@ import { LOCKFILE_NAME } from './lockfile.js'
21
21
  import { configImportOwners } from './config-imports.js'
22
22
  import { configImports } from './config-cache.js'
23
23
  import { WORKSPACE_CONFIG_FILENAMES } from './project-loader.js'
24
- import { WORKSPACE_FINGERPRINT_FILES } from './fingerprint.js'
24
+ import { bunPatchFiles, WORKSPACE_FINGERPRINT_FILES } from './fingerprint.js'
25
25
  import { buildPackageGraph } from './package-graph.js'
26
26
  import type { PackageJson, ProjectMeta } from './workspace.js'
27
27
 
@@ -212,6 +212,16 @@ export async function affectedProjects(args: AffectedArgs): Promise<Set<string>>
212
212
  return new Set(args.projects.map((p) => p.name))
213
213
  }
214
214
  const fingerprintChanged = changed.filter((p) => FINGERPRINT_SET.has(p))
215
+ // A patch bun.lock names folds into every key, core's fingerprint and
216
+ // `bun()`'s claim alike, so its edit widens as a lockfile edit does. A
217
+ // patch the lockfile no longer names moved bun.lock itself.
218
+ if (changed.length > 0) {
219
+ const lock = await bytesOrNull(path.join(args.workspaceRoot, 'bun.lock'))
220
+ if (lock !== null) {
221
+ const patches = new Set(bunPatchFiles(lock))
222
+ if (changed.some((p) => patches.has(p))) return new Set(args.projects.map((p) => p.name))
223
+ }
224
+ }
215
225
  const claimedOwned = new Set<string>()
216
226
  // A claim may also name a root file core does not fold (`turbo.json`,
217
227
  // read by `turbo()`'s stages): it re-keys tasks through their resolved
@@ -106,9 +106,54 @@ export async function computeWorkspaceFingerprints(
106
106
  unclaimed = xxh3(`${f}\0`, unclaimed)
107
107
  unclaimed = xxh3(bytes, unclaimed)
108
108
  }
109
+ // bun.lock names a patch by PATH, never by its content: an edited patch
110
+ // left the lockfile byte-identical and every key unmoved while the
111
+ // install applied the new one (item 1014, where only `bun()`'s claim
112
+ // learned it). Each file it names folds here; a claimed bun.lock's
113
+ // plugin folds them itself.
114
+ const bunLock = files.get('bun.lock')
115
+ if (bunLock !== undefined) {
116
+ for (const rel of bunPatchFiles(bunLock)) {
117
+ const bytes = await readOnce(reads, path.join(workspaceRoot, rel))
118
+ const mark = `patch\0${rel}\0${bytes === null ? 'gone' : 'present'}`
119
+ all = xxh3(mark, all)
120
+ if (bytes !== null) all = xxh3(bytes, all)
121
+ if (claimed.has('bun.lock')) continue
122
+ unclaimed = xxh3(mark, unclaimed)
123
+ if (bytes !== null) unclaimed = xxh3(bytes, unclaimed)
124
+ }
125
+ }
109
126
  return { all: hex(all), unclaimed: hex(unclaimed), files }
110
127
  }
111
128
 
129
+ const PATCHED = new TextEncoder().encode('"patchedDependencies"')
130
+
131
+ /**
132
+ * The workspace-relative patch files a `bun.lock` names, sorted; none
133
+ * outside the workspace. A lockfile without the key is not parsed (the
134
+ * common case costs one byte search), and one that will not parse names
135
+ * none: its bytes still fold whole.
136
+ */
137
+ export function bunPatchFiles(bytes: Uint8Array): string[] {
138
+ if (Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).indexOf(PATCHED) < 0) return []
139
+ let doc: unknown
140
+ try {
141
+ doc = Bun.JSONC.parse(new TextDecoder().decode(bytes))
142
+ } catch {
143
+ return []
144
+ }
145
+ const patched = (doc as { patchedDependencies?: unknown } | null)?.patchedDependencies
146
+ if (patched === null || typeof patched !== 'object') return []
147
+ const out = new Set<string>()
148
+ for (const v of Object.values(patched)) {
149
+ if (typeof v !== 'string') continue
150
+ const rel = path.posix.normalize(v.split(path.sep).join('/'))
151
+ if (rel.startsWith('../') || rel === '..' || path.posix.isAbsolute(rel)) continue
152
+ out.add(rel)
153
+ }
154
+ return [...out].sort()
155
+ }
156
+
112
157
  function hex(h: bigint): string {
113
158
  return h.toString(16).padStart(16, '0')
114
159
  }