@vzn/vx 0.0.277 → 0.0.278

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.277",
3
+ "version": "0.0.278",
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.277",
21
- "@vzn/vx-linux-arm64": "0.0.277",
22
- "@vzn/vx-darwin-x64": "0.0.277",
23
- "@vzn/vx-darwin-arm64": "0.0.277"
20
+ "@vzn/vx-linux-x64": "0.0.278",
21
+ "@vzn/vx-linux-arm64": "0.0.278",
22
+ "@vzn/vx-darwin-x64": "0.0.278",
23
+ "@vzn/vx-darwin-arm64": "0.0.278"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/cli/show.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  // <task>`: one task. `<task>`: that task in every project declaring it.
7
7
  // Deliberately NOT the lock — vx-lock.json is already the frozen JSON.
8
8
 
9
+ import path from 'node:path'
9
10
  import type { ProjectConfig, TaskConfig } from '../config.js'
10
11
  import { declaredTask } from '../graph/index.js'
11
12
  import { flagHint, seeHelp } from './help.js'
@@ -65,6 +66,10 @@ export async function showCmd(args: readonly string[]): Promise<number> {
65
66
  const metas = await discoverCliProjects(await loadWorkspace(root, reads))
66
67
  const byName = new Map(metas.map((m) => [m.name, m]))
67
68
 
69
+ // `//#task` is Turbo's root package's task: the root project here (D-39).
70
+ const rootMeta = metas.find((m) => path.resolve(m.dir) === path.resolve(root))
71
+ if (parsed.target?.startsWith('//#') && rootMeta !== undefined)
72
+ parsed.target = `${rootMeta.name}#${parsed.target.slice(3)}`
68
73
  const hashAt = parsed.target?.indexOf('#') ?? -1
69
74
  const projectName =
70
75
  parsed.target === undefined
package/src/cli/why.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  // names the exact cache-key components that differ. Read-only over cache.db —
6
6
  // no config evaluation, no re-hash.
7
7
 
8
+ import path from 'node:path'
8
9
  import { Cache, noteSchemaReset } from '../cache/index.js'
9
10
  import { flagHint, seeHelp } from './help.js'
10
11
  import { splitTaskId } from '../graph/index.js'
@@ -159,6 +160,16 @@ function resolveTarget(cache: Cache, target: string): string {
159
160
 
160
161
  const fmtWhen = (ms: number): string => new Date(ms).toISOString()
161
162
 
163
+ /** `//#task`, Turbo's root package, as the root project's id: its package.json name (D-39). */
164
+ async function rootSpelled(root: string, target: string): Promise<string> {
165
+ if (!target.startsWith('//#')) return target
166
+ const name = await Bun.file(path.join(root, 'package.json'))
167
+ .json()
168
+ .then((j: { name?: unknown }) => j.name)
169
+ .catch(() => undefined)
170
+ return typeof name === 'string' && name !== '' ? `${name}#${target.slice(3)}` : target
171
+ }
172
+
162
173
  export async function whyCmd(args: readonly string[]): Promise<number> {
163
174
  const parsed = parseWhyArgs(args)
164
175
  if (parsed.error !== undefined) throw new UserError(`vx why: ${parsed.error}`)
@@ -171,7 +182,7 @@ export async function whyCmd(args: readonly string[]): Promise<number> {
171
182
  noteSchemaReset(cache, warnToStderr)
172
183
  try {
173
184
  const db = cache.dbHandle()
174
- const taskId = resolveTarget(cache, parsed.target)
185
+ const taskId = resolveTarget(cache, await rootSpelled(root, parsed.target))
175
186
  const runId =
176
187
  parsed.runId !== undefined
177
188
  ? (resolveRunId(db, parsed.runId, 'vx why') ?? parsed.runId)