@vzn/vx 0.0.474 → 0.0.475

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.474",
3
+ "version": "0.0.475",
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.474",
25
- "@vzn/vx-linux-arm64": "0.0.474",
26
- "@vzn/vx-darwin-x64": "0.0.474",
27
- "@vzn/vx-darwin-arm64": "0.0.474"
24
+ "@vzn/vx-linux-x64": "0.0.475",
25
+ "@vzn/vx-linux-arm64": "0.0.475",
26
+ "@vzn/vx-darwin-x64": "0.0.475",
27
+ "@vzn/vx-darwin-arm64": "0.0.475"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -70,7 +70,14 @@ export function completionScript(shell: CompletionShell, verbs: readonly string[
70
70
  ...table.map((t) => ` ${t.verb}) compadd -- ${t.words.join(' ')} ;;`),
71
71
  ' esac',
72
72
  '}',
73
- 'compdef _vx vx',
73
+ // Autoloaded from $fpath (the `#compdef` file), this body runs on
74
+ // the first Tab: it must complete then, not only define `_vx`, or
75
+ // that Tab rings the bell. Sourced, it registers instead.
76
+ 'if [[ "${funcstack[1]}" == _vx ]]; then',
77
+ ' _vx "$@"',
78
+ 'else',
79
+ ' compdef _vx vx',
80
+ 'fi',
74
81
  '',
75
82
  ].join('\n')
76
83
  case 'fish':
@@ -8,8 +8,9 @@
8
8
  // before this is asked, so a plugin cannot shadow `run`.
9
9
 
10
10
  import type { VxPlugin, PluginCommand, CommandContext } from '../orchestrator/index.js'
11
- import { findWorkspaceRoot } from '../workspace/index.js'
12
- import { loadCliWorkspace } from './workspace-config.js'
11
+ import { existsSync } from 'node:fs'
12
+ import path from 'node:path'
13
+ import { findWorkspaceRoot, WORKSPACE_CONFIG_FILENAMES } from '../workspace/index.js'
13
14
  import { machineParallelism, maskedLine } from '../util/index.js'
14
15
 
15
16
  export interface ResolvedPluginCommand {
@@ -52,8 +53,14 @@ async function workspacePlugins(
52
53
  } catch {
53
54
  return null
54
55
  }
56
+ // Plugins are declared only in a workspace file. Without one, the load
57
+ // below is the orchestrator's import graph (~50 ms) for an empty list,
58
+ // paid by `vx help` and by the `vx completions` a shell sources at start.
59
+ if (!WORKSPACE_CONFIG_FILENAMES.some((f) => existsSync(path.join(workspaceRoot, f))))
60
+ return { workspaceRoot, cacheDir: '', concurrency: 0, plugins: [] }
55
61
  let ws
56
62
  try {
63
+ const { loadCliWorkspace } = await import('./workspace-config.js')
57
64
  ws = await loadCliWorkspace(workspaceRoot)
58
65
  } catch (err) {
59
66
  return { loadError: err instanceof Error ? err.message : String(err) }
@@ -13,6 +13,9 @@ const ABSENT = -1n
13
13
  function settledState(abs: string): bigint {
14
14
  let st: fs.Stats
15
15
  try {
16
+ // A link is its target string, as the key folds it: following it saw
17
+ // a retarget to equal bytes as "the same" and ran nothing.
18
+ if (fs.lstatSync(abs).isSymbolicLink()) return xxh3(`link:${fs.readlinkSync(abs)}`)
16
19
  st = fs.statSync(abs)
17
20
  } catch {
18
21
  return ABSENT
@@ -484,9 +484,16 @@ export function validateProjectConfig(config: ProjectConfig, configPath: string)
484
484
  assertKnownFields(cache, CACHE_FIELDS, `${where}.cache`)
485
485
  const inputs = (cache as { inputs?: unknown }).inputs
486
486
  const outputs = (cache as { outputs?: unknown }).outputs
487
- if (!inputs || typeof inputs !== 'object') {
487
+ // A present field of the wrong shape (`outputs: 'dist'`) was told it
488
+ // was missing; an array is named in `assertKnownFields`.
489
+ if (inputs === undefined || inputs === null) {
488
490
  throw new UserError(`${where}.cache.inputs is required when \`cache\` is set`)
489
491
  }
492
+ if (typeof inputs !== 'object') {
493
+ throw new UserError(
494
+ `${where}.cache.inputs must be an object — \`inputs: { files: [...] }\``,
495
+ )
496
+ }
490
497
  assertKnownFields(inputs, CACHE_INPUT_FIELDS, `${where}.cache.inputs`)
491
498
  if (!Array.isArray((inputs as { files?: unknown }).files)) {
492
499
  throw new UserError(`${where}.cache.inputs.files must be an array of glob strings`)
@@ -520,9 +527,14 @@ export function validateProjectConfig(config: ProjectConfig, configPath: string)
520
527
  }
521
528
  }
522
529
  }
523
- if (!outputs || typeof outputs !== 'object') {
530
+ if (outputs === undefined || outputs === null) {
524
531
  throw new UserError(`${where}.cache.outputs is required when \`cache\` is set`)
525
532
  }
533
+ if (typeof outputs !== 'object') {
534
+ throw new UserError(
535
+ `${where}.cache.outputs must be an object — \`outputs: { files: [...] }\``,
536
+ )
537
+ }
526
538
  assertKnownFields(outputs, CACHE_OUTPUT_FIELDS, `${where}.cache.outputs`)
527
539
  const outFiles = (outputs as { files?: unknown }).files
528
540
  if (!Array.isArray(outFiles)) {