@vzn/vx 0.0.125 → 0.0.127

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.125",
3
+ "version": "0.0.127",
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.125",
21
- "@vzn/vx-linux-arm64": "0.0.125",
22
- "@vzn/vx-darwin-x64": "0.0.125",
23
- "@vzn/vx-darwin-arm64": "0.0.125"
20
+ "@vzn/vx-linux-x64": "0.0.127",
21
+ "@vzn/vx-linux-arm64": "0.0.127",
22
+ "@vzn/vx-darwin-x64": "0.0.127",
23
+ "@vzn/vx-darwin-arm64": "0.0.127"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -379,7 +379,9 @@ export function validateProjectConfig(config: ProjectConfig, configPath: string)
379
379
  const persistent = (exec as { persistent?: unknown }).persistent
380
380
  if (persistent !== undefined) {
381
381
  if (typeof persistent !== 'object' || persistent === null) {
382
- throw new UserError(`${where}.exec.persistent must be an object (or omitted)`)
382
+ throw new UserError(
383
+ `${where}.exec.persistent must be an object (or omitted) — \`persistent: {}\`, or \`{ readyWhen: '<regex>' }\` to wait for a line`,
384
+ )
383
385
  }
384
386
  // The one nested object that had no unknown-key check while every
385
387
  // sibling did — and the failure it let through is the quiet kind:
@@ -451,7 +453,9 @@ export function validateProjectConfig(config: ProjectConfig, configPath: string)
451
453
  }
452
454
  if (cache !== undefined) {
453
455
  if (typeof cache !== 'object' || cache === null) {
454
- throw new UserError(`${where}.cache must be an object when present`)
456
+ throw new UserError(
457
+ `${where}.cache must be an object when present — \`cache: { inputs: { files: [...] }, outputs: { files: [...] } }\`, or no \`cache\` for a task that never caches`,
458
+ )
455
459
  }
456
460
  assertKnownFields(cache, CACHE_FIELDS, `${where}.cache`)
457
461
  const inputs = (cache as { inputs?: unknown }).inputs
@@ -697,6 +701,29 @@ export const REMOVED_FIELDS: ReadonlyMap<
697
701
  ],
698
702
  ])
699
703
 
704
+ /**
705
+ * Another runner's spelling of a field vx has under another name, by the
706
+ * level that meets it (D-37): a Turbo `outputs: [...]` or Nx `command` on
707
+ * a task was refused as an unknown field that named neither the field
708
+ * nor where vx keeps it.
709
+ */
710
+ const FOREIGN_FIELDS: ReadonlyMap<ReadonlySet<string>, Readonly<Record<string, string>>> = new Map([
711
+ [
712
+ TASK_FIELDS,
713
+ {
714
+ inputs: '`cache.inputs.files`',
715
+ outputs: '`cache.outputs.files`',
716
+ env: '`cache.inputs.env` (to key the task on a variable) or `exec.env` (to pass one)',
717
+ passThroughEnv: '`exec.env.passThrough`',
718
+ command: '`exec.command`',
719
+ cmd: '`exec.command`',
720
+ script: '`exec.command`',
721
+ persistent: '`exec.persistent: {}`',
722
+ },
723
+ ],
724
+ [EXEC_FIELDS, { cmd: '`command`', script: '`command`' }],
725
+ ])
726
+
700
727
  function assertKnownFields(value: object, allowed: ReadonlySet<string>, where: string): void {
701
728
  // `typeof [] === 'object'`, so an array reaches here and its indices read
702
729
  // as fields: `outputs: ['dist/**']` (Turbo's spelling) was refused as
@@ -717,10 +744,15 @@ function assertKnownFields(value: object, allowed: ReadonlySet<string>, where: s
717
744
  }
718
745
  // The nearest accepted spelling first: the list says what the level
719
746
  // takes, the hint says which one was meant.
747
+ const foreign = FOREIGN_FIELDS.get(allowed)?.[key]
720
748
  const near = nearest(key, allowed)
721
749
  throw new UserError(
722
750
  `${where} has unknown field "${key}" (allowed: ${[...allowed].sort().join(', ')})` +
723
- (near === undefined ? '' : ` — did you mean ${near}?`),
751
+ (foreign !== undefined
752
+ ? ` — vx spells it ${foreign}`
753
+ : near === undefined
754
+ ? ''
755
+ : ` — did you mean ${near}?`),
724
756
  )
725
757
  }
726
758
  }