@vzn/vx 0.0.153 → 0.0.154

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.153",
3
+ "version": "0.0.154",
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.153",
21
- "@vzn/vx-linux-arm64": "0.0.153",
22
- "@vzn/vx-darwin-x64": "0.0.153",
23
- "@vzn/vx-darwin-arm64": "0.0.153"
20
+ "@vzn/vx-linux-x64": "0.0.154",
21
+ "@vzn/vx-linux-arm64": "0.0.154",
22
+ "@vzn/vx-darwin-x64": "0.0.154",
23
+ "@vzn/vx-darwin-arm64": "0.0.154"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -3,7 +3,7 @@
3
3
  // ownership moves to the run's registry, and this is the one place that
4
4
  // decides which of them outlive the graph and how the rest go down.
5
5
 
6
- import type { TaskNode } from '../graph/index.js'
6
+ import { isGroupTask, type TaskNode } from '../graph/index.js'
7
7
  import { killGraceMs } from '../util/index.js'
8
8
  import { holdGroups, killTree, untilGroupsGone } from '../exec/index.js'
9
9
 
@@ -25,9 +25,12 @@ export interface KeepAlive {
25
25
  /**
26
26
  * A persistent task the user REQUESTED (or one surfaced for display) is the
27
27
  * run's whole purpose — it is left running and blocked on at the very end,
28
- * after the summary. Only in the real CLI foreground: a custom logger or
29
- * `handleSignals: false` (watch mode, embedders) expects `run()` to return,
30
- * not to sit on a server.
28
+ * after the summary. So is every persistent task a kept one depends on,
29
+ * directly or through groups: `vx run dev --filter app` stopped the api#dev
30
+ * its app#dev was started against (C-46). A one-shot's persistent deps are
31
+ * not kept on its account; it has finished with them. Only in the real CLI
32
+ * foreground: a custom logger or `handleSignals: false` (watch mode,
33
+ * embedders) expects `run()` to return, not to sit on a server.
31
34
  */
32
35
  export function selectKeepAlive(
33
36
  registry: ReadonlyMap<string, Child>,
@@ -36,13 +39,25 @@ export function selectKeepAlive(
36
39
  ): KeepAlive {
37
40
  const out: KeepAlive = { nodes: [], children: [] }
38
41
  if (!foreground) return out
39
- for (const [id, child] of registry) {
42
+ const stack = [...registry.keys()].filter((id) => {
40
43
  const n = nodes.get(id)
41
- if (n !== undefined && (n.requested || n.surfaced === true)) {
42
- out.nodes.push(n)
43
- out.children.push(child)
44
+ return n !== undefined && (n.requested || n.surfaced === true)
45
+ })
46
+ const reached = new Set<string>()
47
+ while (stack.length > 0) {
48
+ const id = stack.pop()!
49
+ if (reached.has(id)) continue
50
+ reached.add(id)
51
+ for (const dep of nodes.get(id)?.deps ?? []) {
52
+ const d = nodes.get(dep)
53
+ if (d !== undefined && (registry.has(dep) || isGroupTask(d))) stack.push(dep)
44
54
  }
45
55
  }
56
+ for (const [id, child] of registry) {
57
+ if (!reached.has(id)) continue
58
+ out.nodes.push(nodes.get(id)!)
59
+ out.children.push(child)
60
+ }
46
61
  return out
47
62
  }
48
63