@vzn/vx 0.0.549 → 0.0.550

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.549",
3
+ "version": "0.0.550",
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.549",
25
- "@vzn/vx-linux-arm64": "0.0.549",
26
- "@vzn/vx-darwin-x64": "0.0.549",
27
- "@vzn/vx-darwin-arm64": "0.0.549"
24
+ "@vzn/vx-linux-x64": "0.0.550",
25
+ "@vzn/vx-linux-arm64": "0.0.550",
26
+ "@vzn/vx-darwin-x64": "0.0.550",
27
+ "@vzn/vx-darwin-arm64": "0.0.550"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -23,16 +23,19 @@ import {
23
23
  computeWorkspaceFingerprint,
24
24
  findWorkspaceRoot,
25
25
  type LoadReads,
26
- loadProjectConfig,
27
26
  loadWorkspace,
28
27
  lockfilePath,
29
- type ProjectMeta,
30
28
  resolveCacheDir,
31
29
  resolveStoreRoot,
32
30
  } from '../workspace/index.js'
33
31
  import { flakyTasks, type FlakyTask } from './failure-mode.js'
34
32
  import type { VxPlugin } from './plugin.js'
35
- import { discoverProjects, loadProjects, loadWorkspacePlugins } from './projects.js'
33
+ import {
34
+ discoverProjects,
35
+ type LoadProjectsArgs,
36
+ loadProjects,
37
+ loadWorkspacePlugins,
38
+ } from './projects.js'
36
39
 
37
40
  const warnToStderr = (message: string): void => {
38
41
  process.stderr.write(`${message}\n`)
@@ -167,23 +170,23 @@ async function collectWorkspaceInfo(
167
170
  // The run path's load — a plugin's `project` stage counts — so the
168
171
  // doctor's task count is the number a run would see. A broken config
169
172
  // must not take the doctor down with it: the count then falls back to
170
- // the configs that do load, one by one, the broken ones as zero.
171
- try {
172
- const loaded = await loadProjects({
173
+ // the same load, one project at a time, the broken ones as zero.
174
+ const load = {
175
+ workspaceRoot: root,
176
+ cacheDir,
177
+ plugins,
178
+ projectMetas: metas,
179
+ closure: false,
180
+ lock: null,
181
+ evalCache: {
182
+ store: cache,
173
183
  workspaceRoot: root,
174
- cacheDir,
175
- plugins,
176
- projectMetas: metas,
177
- seeds: 'all',
178
- closure: false,
179
- lock: null,
180
- evalCache: {
181
- store: cache,
182
- workspaceRoot: root,
183
- workspaceFingerprint: await computeWorkspaceFingerprint(root, reads),
184
- },
185
- warn,
186
- })
184
+ workspaceFingerprint: await computeWorkspaceFingerprint(root, reads),
185
+ },
186
+ warn,
187
+ } as const
188
+ try {
189
+ const loaded = await loadProjects({ ...load, seeds: 'all' })
187
190
  for (const p of loaded.projects.values()) {
188
191
  const tasks = p.config.tasks ?? {}
189
192
  taskCount += Object.keys(tasks).length
@@ -197,7 +200,7 @@ async function collectWorkspaceInfo(
197
200
  tasks: taskCount,
198
201
  sandboxed,
199
202
  errors: configErrors,
200
- } = await countLoadableTasks(metas, root))
203
+ } = await countLoadableTasks(load, root))
201
204
  }
202
205
  } finally {
203
206
  cache.close()
@@ -362,18 +365,19 @@ function gitVersion(): string | null {
362
365
  }
363
366
 
364
367
  async function countLoadableTasks(
365
- metas: readonly ProjectMeta[],
368
+ load: Omit<LoadProjectsArgs, 'seeds'> & { closure: false },
366
369
  root: string,
367
370
  ): Promise<{ tasks: number; sandboxed: number; errors: InfoFacts['configErrors'] }> {
368
371
  let tasks = 0
369
372
  let sandboxed = 0
370
373
  const errors: InfoFacts['configErrors'] = []
374
+ // No seeds loads nothing and answers which projects an 'all' load seeds.
375
+ const { configured } = await loadProjects({ ...load, seeds: [] })
371
376
  await Promise.all(
372
- metas.map(async (meta) => {
373
- if (meta.configPath === null) return
377
+ configured.map(async (meta) => {
374
378
  try {
375
- const config = await loadProjectConfig(meta.configPath)
376
- const declared = Object.values(config.tasks ?? {})
379
+ const loaded = await loadProjects({ ...load, seeds: [meta.name] })
380
+ const declared = Object.values(loaded.projects.get(meta.name)?.config.tasks ?? {})
377
381
  tasks += declared.length
378
382
  for (const t of declared) if (t?.exec?.sandbox !== undefined) sandboxed++
379
383
  } catch (err) {
@@ -385,11 +389,12 @@ async function countLoadableTasks(
385
389
  // still did).
386
390
  const raw = err instanceof Error ? err.message : String(err)
387
391
  const bare = raw.startsWith('Project config ') ? raw.slice('Project config '.length) : raw
388
- const message = bare.startsWith(`${meta.configPath}:`)
389
- ? bare.slice(meta.configPath.length + 1).trimStart()
392
+ const where = meta.configPath ?? meta.dir
393
+ const message = bare.startsWith(`${where}:`)
394
+ ? bare.slice(where.length + 1).trimStart()
390
395
  : raw
391
396
  errors.push({
392
- path: path.relative(root, meta.configPath).split(path.sep).join('/'),
397
+ path: path.relative(root, where).split(path.sep).join('/'),
393
398
  message,
394
399
  })
395
400
  }
@@ -175,7 +175,14 @@ self.onmessage = async (e) => {
175
175
  fn: typeof mod === 'function',
176
176
  changed: report,
177
177
  })
178
- } catch (err) {
178
+ } catch (thrown) {
179
+ // Two syntax errors arrive as one AggregateError, whose own message
180
+ // names no line; the in-process load reports the first (X-6), so the
181
+ // hop does too (X-26).
182
+ const err =
183
+ thrown?.name === 'AggregateError' && Array.isArray(thrown.errors) && thrown.errors.length > 0
184
+ ? thrown.errors[0]
185
+ : thrown
179
186
  const report = changed()
180
187
  umaskBack()
181
188
  postMessage({