@vzn/vx 0.0.242 → 0.0.243

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.242",
3
+ "version": "0.0.243",
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.242",
21
- "@vzn/vx-linux-arm64": "0.0.242",
22
- "@vzn/vx-darwin-x64": "0.0.242",
23
- "@vzn/vx-darwin-arm64": "0.0.242"
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"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/cli/run.ts CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  } from '../orchestrator/index.js'
16
16
  import type { ContinueMode } from '../graph/index.js'
17
17
  import { type CachePolicy, FULL_CACHE_POLICY, parseCachePolicy } from '../cache/index.js'
18
- import { findCwdProject, pickTask, resolveFilters } from './select.js'
18
+ import { findCwdSelection, pickTask, resolveFilters } from './select.js'
19
19
  import { nxTargetHint, taskNamesHere } from './task-verb.js'
20
20
  import { MAX_TIMEOUT_MS, isUserError, parseDecimalInt, machineParallelism } from '../util/index.js'
21
21
  import { formatGraphDot, formatPlanJson, formatPlanText } from './plan-format.js'
@@ -511,7 +511,7 @@ export async function resolveRunOptions(
511
511
  } else if (parsed.all) {
512
512
  projects = undefined
513
513
  } else {
514
- const cwdProject = await findCwdProject(cwd)
514
+ const cwdProject = await findCwdSelection(cwd)
515
515
  if (!cwdProject) {
516
516
  const nx = await nxTargetHint(tasks, cwd)
517
517
  if (nx !== null) return { error: nx }
@@ -520,7 +520,8 @@ export async function resolveRunOptions(
520
520
  'not inside a project. Pass --all for every project, --filter <pattern> to filter, or run from within a project directory.',
521
521
  }
522
522
  }
523
- projects = [cwdProject]
523
+ projects = [cwdProject.name]
524
+ discovered = cwdProject.discovered
524
525
  }
525
526
 
526
527
  const opts: RunOptions = {
package/src/cli/select.ts CHANGED
@@ -118,7 +118,20 @@ async function loadWorkspaceProjects(cwd: string): Promise<ProjectMeta[]> {
118
118
  }
119
119
 
120
120
  export async function findCwdProject(cwd: string): Promise<string | null> {
121
- const projects = await loadWorkspaceProjects(cwd)
121
+ return (await findCwdSelection(cwd))?.name ?? null
122
+ }
123
+
124
+ /**
125
+ * The project `cwd` is in, and the discovery that found it, for the run to
126
+ * reuse (`RunOptions.discovered`): discovering again ran every `discover`
127
+ * hook twice (`nx()`'s graph load and worktree key among them).
128
+ */
129
+ export async function findCwdSelection(
130
+ cwd: string,
131
+ ): Promise<{ name: string; discovered: { root: string; projects: ProjectMeta[] } } | null> {
132
+ const reads: LoadReads = new Map()
133
+ const root = await findWorkspaceRoot(cwd, reads)
134
+ const projects = await discoverCliProjects(await loadWorkspace(root, reads))
122
135
  const abs = path.resolve(cwd)
123
136
  const within = (dirOf: (p: ProjectMeta) => string): string | null => {
124
137
  let best: string | null = null
@@ -137,7 +150,7 @@ export async function findCwdProject(cwd: string): Promise<string | null> {
137
150
  // so inside such a member nothing matched and a run from there was "not
138
151
  // inside a project" (item 1025). Only then are the members realpathed:
139
152
  // one syscall each, paid only by a run no plain match could place.
140
- return (
153
+ const name =
141
154
  within((p) => p.dir) ??
142
155
  within((p) => {
143
156
  try {
@@ -146,7 +159,7 @@ export async function findCwdProject(cwd: string): Promise<string | null> {
146
159
  return p.dir
147
160
  }
148
161
  })
149
- )
162
+ return name === null ? null : { name, discovered: { root, projects } }
150
163
  }
151
164
 
152
165
  export type FilterResolution =
@@ -41,7 +41,8 @@ export interface RunOptions {
41
41
  staged?: ReadonlyMap<string, ProjectEntry>
42
42
  /**
43
43
  * The projects a selection pass in this same process discovered under
44
- * `root` (`--filter`, `--affected`). The run takes them instead of
44
+ * `root` (`--filter`, `--affected`, the project a run from inside one
45
+ * is in). The run takes them instead of
45
46
  * walking the workspace again when its root is the same. One run only,
46
47
  * as `staged` is.
47
48
  */