@vzn/vx 0.0.422 → 0.0.424
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 +5 -5
- package/src/cli/watch.ts +16 -17
- package/src/workspace/migration.ts +22 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.424",
|
|
4
4
|
"description": "The fastest task runner and build cache for JavaScript monorepos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
23
23
|
"optionalDependencies": {
|
|
24
|
-
"@vzn/vx-linux-x64": "0.0.
|
|
25
|
-
"@vzn/vx-linux-arm64": "0.0.
|
|
26
|
-
"@vzn/vx-darwin-x64": "0.0.
|
|
27
|
-
"@vzn/vx-darwin-arm64": "0.0.
|
|
24
|
+
"@vzn/vx-linux-x64": "0.0.424",
|
|
25
|
+
"@vzn/vx-linux-arm64": "0.0.424",
|
|
26
|
+
"@vzn/vx-darwin-x64": "0.0.424",
|
|
27
|
+
"@vzn/vx-darwin-arm64": "0.0.424"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/sandbox-runtime": "^0.0.76"
|
package/src/cli/watch.ts
CHANGED
|
@@ -205,6 +205,11 @@ export async function watchCmd(args: readonly string[]): Promise<number> {
|
|
|
205
205
|
const swept = await sweepConfigs(allProjects, workspaceRoot, load, opts.tasks)
|
|
206
206
|
const watched = await watchedProjects(workspaceRoot, allProjects, scope, load, swept.staged)
|
|
207
207
|
const ws = await loadCliWorkspace(workspaceRoot)
|
|
208
|
+
const claimsOf = (plugins: Parameters<typeof fingerprintClaims>[0]): Set<string> =>
|
|
209
|
+
new Set([
|
|
210
|
+
...fingerprintClaims(plugins).keys(),
|
|
211
|
+
...(opts.frozen === true ? [LOCKFILE_NAME] : []),
|
|
212
|
+
])
|
|
208
213
|
return await runWatchLoop({
|
|
209
214
|
opts,
|
|
210
215
|
held,
|
|
@@ -232,6 +237,10 @@ export async function watchCmd(args: readonly string[]): Promise<number> {
|
|
|
232
237
|
const now = await watchedProjects(workspaceRoot, all, inScope(all), load, sweep.staged)
|
|
233
238
|
return {
|
|
234
239
|
projects: now,
|
|
240
|
+
// A plugin the workspace config gained since claims its file from
|
|
241
|
+
// the cycle that loaded it; read once, its edits started nothing
|
|
242
|
+
// until a restart.
|
|
243
|
+
claimedRootFiles: claimsOf((await loadCliWorkspace(workspaceRoot)).plugins),
|
|
235
244
|
memberBases: memberBaseDirs(workspace),
|
|
236
245
|
workspaceWide: sweep.workspaceWide,
|
|
237
246
|
workspaceInputs: sweep.workspaceInputs,
|
|
@@ -246,10 +255,7 @@ export async function watchCmd(args: readonly string[]): Promise<number> {
|
|
|
246
255
|
// Under --frozen every cycle's configs are the lock's, so a re-lock is
|
|
247
256
|
// the one edit that changes what a cycle runs; unheard, the loop ran
|
|
248
257
|
// the old lock until a restart (item 971).
|
|
249
|
-
claimedRootFiles:
|
|
250
|
-
...fingerprintClaims(ws.plugins).keys(),
|
|
251
|
-
...(opts.frozen === true ? [LOCKFILE_NAME] : []),
|
|
252
|
-
]),
|
|
258
|
+
claimedRootFiles: claimsOf(ws.plugins),
|
|
253
259
|
// The RESOLVED cache dir, not the `.vx` literal — see `makeWatchIgnore`.
|
|
254
260
|
cacheDir: opts.cacheDir ?? ws.cacheDir,
|
|
255
261
|
})
|
|
@@ -296,6 +302,7 @@ interface WatchLoopArgs {
|
|
|
296
302
|
|
|
297
303
|
interface Rediscovered {
|
|
298
304
|
projects: readonly ProjectMeta[]
|
|
305
|
+
claimedRootFiles: ReadonlySet<string>
|
|
299
306
|
memberBases: readonly string[]
|
|
300
307
|
workspaceWide: boolean
|
|
301
308
|
workspaceInputs: readonly string[]
|
|
@@ -319,6 +326,7 @@ async function runWatchLoop(args: WatchLoopArgs): Promise<number> {
|
|
|
319
326
|
let outputs = args.outputs
|
|
320
327
|
let inputs = args.inputs
|
|
321
328
|
let uncached = args.uncached
|
|
329
|
+
let claimedRootFiles = args.claimedRootFiles
|
|
322
330
|
let configImportFiles = args.configImports
|
|
323
331
|
let wsConfigImportFiles = args.workspaceConfigImports
|
|
324
332
|
// A dev server stays up while the loop idles; the cycle that replaces it
|
|
@@ -398,12 +406,7 @@ async function runWatchLoop(args: WatchLoopArgs): Promise<number> {
|
|
|
398
406
|
// project would otherwise trigger every save during `bun install` —
|
|
399
407
|
// and vx's own cache writes would trigger a cycle that writes again.
|
|
400
408
|
let isIgnoredPath = makeWatchIgnore(cacheDir, outputs, inputs)
|
|
401
|
-
let matters = makeRootEventFilter(
|
|
402
|
-
workspaceRoot,
|
|
403
|
-
projectDirs,
|
|
404
|
-
workspaceInputs,
|
|
405
|
-
args.claimedRootFiles,
|
|
406
|
-
)
|
|
409
|
+
let matters = makeRootEventFilter(workspaceRoot, projectDirs, workspaceInputs, claimedRootFiles)
|
|
407
410
|
/** Since the last cycle, a member came or went, or a file that shapes the watched set changed (`shapesWatchedSet`). */
|
|
408
411
|
let reread = false
|
|
409
412
|
|
|
@@ -466,7 +469,7 @@ async function runWatchLoop(args: WatchLoopArgs): Promise<number> {
|
|
|
466
469
|
isWorkspaceFingerprintFile(filename) ||
|
|
467
470
|
isWorkspaceConfigFile(filename) ||
|
|
468
471
|
filename === 'package.json' ||
|
|
469
|
-
|
|
472
|
+
claimedRootFiles.has(filename)
|
|
470
473
|
) {
|
|
471
474
|
if (shapesWatchedSet(filename) || filename === LOCKFILE_NAME) reread = true
|
|
472
475
|
trigger(`root ${filename}`, path.join(workspaceRoot, filename))
|
|
@@ -608,18 +611,14 @@ async function runWatchLoop(args: WatchLoopArgs): Promise<number> {
|
|
|
608
611
|
outputs = next.outputs
|
|
609
612
|
inputs = next.inputs
|
|
610
613
|
uncached = next.uncached
|
|
614
|
+
claimedRootFiles = next.claimedRootFiles
|
|
611
615
|
configImportFiles = next.configImports
|
|
612
616
|
wsConfigImportFiles = next.workspaceConfigImports
|
|
613
617
|
packageDirs = next.packageDirs
|
|
614
618
|
memberBases = next.memberBases
|
|
615
619
|
armBases()
|
|
616
620
|
isIgnoredPath = makeWatchIgnore(cacheDir, outputs, inputs)
|
|
617
|
-
matters = makeRootEventFilter(
|
|
618
|
-
workspaceRoot,
|
|
619
|
-
projectDirs,
|
|
620
|
-
workspaceInputs,
|
|
621
|
-
args.claimedRootFiles,
|
|
622
|
-
)
|
|
621
|
+
matters = makeRootEventFilter(workspaceRoot, projectDirs, workspaceInputs, claimedRootFiles)
|
|
623
622
|
if (next.workspaceWide !== workspaceWide) {
|
|
624
623
|
// A task started or stopped declaring `workspaceFiles`: the other
|
|
625
624
|
// arm's shape. Until item 891 the choice was made once, at start, and
|
|
@@ -256,6 +256,18 @@ export async function applyMigration(args: ApplyMigrationArgs): Promise<number>
|
|
|
256
256
|
const configName = `vx.config.${format}`
|
|
257
257
|
const workspaceName = `vx.workspace.${format}`
|
|
258
258
|
const empty = plan.projects.length === 0
|
|
259
|
+
// `vx init` never overwrites a member's config: a half-adopted workspace
|
|
260
|
+
// keeps each one it has, by name, and gets the rest (M-52). It refused
|
|
261
|
+
// the whole workspace, and `--force` would have replaced the hand-written
|
|
262
|
+
// file; `--force` still replaces, as asked.
|
|
263
|
+
const kept: string[] = []
|
|
264
|
+
const projects = plan.projects.filter((p) => {
|
|
265
|
+
if (!init || force || p.tasks.length === 0) return true
|
|
266
|
+
const existing = metas.find((m) => m.dir === p.dir)?.configPath
|
|
267
|
+
if (!existing) return true
|
|
268
|
+
kept.push(relPosix(root, existing))
|
|
269
|
+
return false
|
|
270
|
+
})
|
|
259
271
|
if (empty && !init) {
|
|
260
272
|
throw new UserError(
|
|
261
273
|
`nothing to migrate: no ${source === 'package.json scripts' ? 'package.json scripts in any workspace member' : 'tasks in ' + source}`,
|
|
@@ -263,7 +275,7 @@ export async function applyMigration(args: ApplyMigrationArgs): Promise<number>
|
|
|
263
275
|
}
|
|
264
276
|
|
|
265
277
|
const files: { relPath: string; abs: string; contents: string }[] = []
|
|
266
|
-
for (const p of
|
|
278
|
+
for (const p of projects) {
|
|
267
279
|
if (p.tasks.length === 0) continue
|
|
268
280
|
const abs = path.join(p.dir, configName)
|
|
269
281
|
files.push({
|
|
@@ -291,7 +303,7 @@ export async function applyMigration(args: ApplyMigrationArgs): Promise<number>
|
|
|
291
303
|
const conflicts = new Set<string>()
|
|
292
304
|
// A discovered project with ANY existing vx config (.ts/.mjs/.js) — refuse
|
|
293
305
|
// so we never shadow a hand-written config with a fresh .ts.
|
|
294
|
-
for (const p of
|
|
306
|
+
for (const p of projects) {
|
|
295
307
|
if (p.tasks.length === 0) continue
|
|
296
308
|
const meta = metas.find((m) => m.dir === p.dir)
|
|
297
309
|
if (meta?.configPath) conflicts.add(relPosix(root, meta.configPath))
|
|
@@ -316,7 +328,7 @@ export async function applyMigration(args: ApplyMigrationArgs): Promise<number>
|
|
|
316
328
|
// order, and the report said "written" for a file the run never loaded
|
|
317
329
|
// (item 1033).
|
|
318
330
|
const replaced: string[] = []
|
|
319
|
-
for (const p of
|
|
331
|
+
for (const p of projects) {
|
|
320
332
|
if (p.tasks.length === 0) continue
|
|
321
333
|
const existing = metas.find((m) => m.dir === p.dir)?.configPath
|
|
322
334
|
if (existing && existing !== path.join(p.dir, configName)) replaced.push(existing)
|
|
@@ -337,7 +349,7 @@ export async function applyMigration(args: ApplyMigrationArgs): Promise<number>
|
|
|
337
349
|
let todoCount = 0
|
|
338
350
|
let clean = 0
|
|
339
351
|
let cached = false
|
|
340
|
-
for (const p of
|
|
352
|
+
for (const p of projects) {
|
|
341
353
|
for (const t of p.tasks) {
|
|
342
354
|
if (t.todos.length === 0 && t.task !== null) clean++
|
|
343
355
|
if (t.task !== null && 'cache' in t.task) cached = true
|
|
@@ -408,8 +420,13 @@ export async function applyMigration(args: ApplyMigrationArgs): Promise<number>
|
|
|
408
420
|
}
|
|
409
421
|
}
|
|
410
422
|
report.push(...plan.notes)
|
|
411
|
-
report.push(dry ? 'files (dry run
|
|
423
|
+
if (files.length === 0) report.push(dry ? 'no files (dry run)' : 'no files written')
|
|
424
|
+
else report.push(dry ? 'files (dry run, nothing written):' : 'files written:')
|
|
412
425
|
for (const f of files) report.push(` ${f.relPath}`)
|
|
426
|
+
if (kept.length > 0) {
|
|
427
|
+
report.push('kept (each already has a vx config):')
|
|
428
|
+
for (const f of kept) report.push(` ${f}`)
|
|
429
|
+
}
|
|
413
430
|
if (replaced.length > 0) {
|
|
414
431
|
report.push(dry ? 'would replace (dry run):' : 'replaced:')
|
|
415
432
|
for (const f of replaced) report.push(` ${relPosix(root, f)}`)
|