@vzn/vx 0.0.551 → 0.0.553

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.551",
3
+ "version": "0.0.553",
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.551",
25
- "@vzn/vx-linux-arm64": "0.0.551",
26
- "@vzn/vx-darwin-x64": "0.0.551",
27
- "@vzn/vx-darwin-arm64": "0.0.551"
24
+ "@vzn/vx-linux-x64": "0.0.553",
25
+ "@vzn/vx-linux-arm64": "0.0.553",
26
+ "@vzn/vx-darwin-x64": "0.0.553",
27
+ "@vzn/vx-darwin-arm64": "0.0.553"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/cli/init.ts CHANGED
@@ -53,6 +53,12 @@ export function parseInitArgs(args: readonly string[]): InitArgs {
53
53
  return { ...out, error: `unknown flag: ${a}${flagHint('init', a)}${seeHelp('init')}` }
54
54
  else return { ...out, error: `unexpected argument: ${a}${seeHelp('init')}` }
55
55
  }
56
+ if (out.plugin !== undefined && out.mjs) {
57
+ return {
58
+ ...out,
59
+ error: '--mjs does not combine with --plugin: the plugin templates are TypeScript',
60
+ }
61
+ }
56
62
  return out
57
63
  }
58
64
 
@@ -139,9 +145,11 @@ async function scaffoldPlugin(seam: string, args: InitArgs): Promise<number> {
139
145
  for (const [rel, text] of files) await Bun.write(path.join(root, rel), text)
140
146
  }
141
147
  const factory = /^export function (\w+)/m.exec(template.plugin)![1]!
148
+ const workspaceFile =
149
+ WORKSPACE_CONFIG_FILENAMES.find((n) => existsSync(path.join(root, n))) ?? 'vx.workspace.ts'
142
150
  process.stdout.write(
143
151
  `${args.dry ? 'would write' : 'wrote'} ${files.map(([rel]) => rel).join(' and ')}\n` +
144
- `Declare it in vx.workspace.ts: import { ${factory} } from './plugins/${seam}.ts', then plugins: [${factory}(…)]\n` +
152
+ `Declare it in ${workspaceFile}: import { ${factory} } from './plugins/${seam}.ts', then plugins: [${factory}(…)]\n` +
145
153
  `Test it: bun test plugins/${seam}.test.ts (needs @vzn/vx installed)\n`,
146
154
  )
147
155
  return 0
package/src/cli/last.ts CHANGED
@@ -34,6 +34,12 @@ interface LastArgs {
34
34
  error?: string
35
35
  }
36
36
 
37
+ /**
38
+ * A run id as typed beside `--list`: a UUIDv7's first group (8 hex digits)
39
+ * at least, whole or cut as `--list` prints it.
40
+ */
41
+ const RUN_ID_SHAPE = /^[0-9a-f]{8}(?:-|$)/i
42
+
37
43
  export function parseLastArgs(args: readonly string[]): LastArgs {
38
44
  const out: LastArgs = { format: 'pretty' }
39
45
  for (let i = 0; i < args.length; i++) {
@@ -41,10 +47,15 @@ export function parseLastArgs(args: readonly string[]): LastArgs {
41
47
  if (a === '--list' || a.startsWith('--list=')) {
42
48
  // `--list 5` is the count, like every other value flag's space form:
43
49
  // it read as a run id, which `--list` then ignored, and ten runs came
44
- // back (item 899). A run id is never a bare integer, so the next
45
- // argument is taken only when it is one.
50
+ // back (item 899). The next argument is the count unless it is a flag
51
+ // or has a run id's shape: `1.5`, `-3` and `abc` read as run ids and
52
+ // were told a run id does not combine with --list (X-29).
46
53
  const next = args[i + 1]
47
- const spaced = a === '--list' && next !== undefined && /^\d+$/.test(next)
54
+ const spaced =
55
+ a === '--list' &&
56
+ next !== undefined &&
57
+ (/^\d+$/.test(next) ||
58
+ (!RUN_ID_SHAPE.test(next) && (!next.startsWith('-') || /^-\d/.test(next))))
48
59
  const lv = a === '--list' ? (spaced ? next : '10') : a.slice(7)
49
60
  if (spaced) i++
50
61
  const n = Number(lv)
@@ -86,6 +97,10 @@ export function parseLastArgs(args: readonly string[]): LastArgs {
86
97
  out.runId = a
87
98
  }
88
99
  // One run's replay or a list of runs, not both: the id was dropped.
100
+ // Beside --list, a word no run id could be is just an extra one.
101
+ if (out.runId !== undefined && out.list !== undefined && !RUN_ID_SHAPE.test(out.runId)) {
102
+ return { ...out, error: `unexpected argument: ${out.runId}${seeHelp('last')}` }
103
+ }
89
104
  if (out.runId !== undefined && out.list !== undefined) {
90
105
  return {
91
106
  ...out,