@vzn/vx 0.0.507 → 0.0.508

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.507",
3
+ "version": "0.0.508",
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.507",
25
- "@vzn/vx-linux-arm64": "0.0.507",
26
- "@vzn/vx-darwin-x64": "0.0.507",
27
- "@vzn/vx-darwin-arm64": "0.0.507"
24
+ "@vzn/vx-linux-x64": "0.0.508",
25
+ "@vzn/vx-linux-arm64": "0.0.508",
26
+ "@vzn/vx-darwin-x64": "0.0.508",
27
+ "@vzn/vx-darwin-arm64": "0.0.508"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/util/index.ts CHANGED
@@ -23,6 +23,7 @@ export { clampInt, formatElapsed, MAX_TIMEOUT_MS, parseDecimalInt } from './num.
23
23
  export {
24
24
  asTrees,
25
25
  BUN_GLOB_WILDCARDS,
26
+ EXTGLOB,
26
27
  grantPrefix,
27
28
  isLiteralPattern,
28
29
  GLOB_WILDCARDS,
package/src/util/paths.ts CHANGED
@@ -179,6 +179,16 @@ export const GLOB_WILDCARDS = /[*?{}]/
179
179
  */
180
180
  export const BUN_GLOB_WILDCARDS = /[*?[\]{}]/
181
181
 
182
+ /**
183
+ * An extglob group: `!(…)`, `@(…)`, `+(…)`, `*(…)`, `?(…)`. npm, yarn,
184
+ * Nx and Turbo read it; `Bun.Glob` has none, and reads the group as
185
+ * literal text or as a plain wildcard. A task input `src/@(x|y).ts` keyed
186
+ * no file, so an edit to `src/x.ts` replayed a stale hit, and a member
187
+ * glob `packages/!(x)` took in x (turborepo#3766). Every glob vx hands
188
+ * `Bun.Glob` from a config refuses it.
189
+ */
190
+ export const EXTGLOB = /[!@+*?]\(/
191
+
182
192
  /**
183
193
  * Compile a task glob for `Bun.Glob`, with every bare bracket escaped so it
184
194
  * matches itself (item 667). Every task glob is compiled here and nowhere
@@ -23,6 +23,7 @@ import {
23
23
  parseSize,
24
24
  UserError,
25
25
  BUN_GLOB_WILDCARDS,
26
+ EXTGLOB,
26
27
  } from '../util/index.js'
27
28
  import { nonJsonMessage, nonJsonPaths } from './json-data.js'
28
29
 
@@ -1066,6 +1067,24 @@ function assertNoForeignToken(glob: string, where: string): void {
1066
1067
  throw new UserError(`${where}: "${glob}" holds ${shown}, ${meaning}`)
1067
1068
  }
1068
1069
  }
1070
+ // A leading `!` is vx's negation, so `!(group)/**` takes back a route group.
1071
+ const body = glob.startsWith('!') ? glob.slice(1) : glob
1072
+ const at = body.search(EXTGLOB)
1073
+ if (at !== -1) {
1074
+ // `@(a|b)` of plain names is exactly `{a,b}`, and `@(a)` is `a`.
1075
+ const group =
1076
+ body[at - 1] === '\\' ? null : /^@\(([^()|]+(?:\|[^()|]+)*)\)/.exec(body.slice(at))
1077
+ const names = group === null ? [] : group[1]!.split('|')
1078
+ const rewrite =
1079
+ group === null || BUN_GLOB_WILDCARDS.test(group[1]!)
1080
+ ? 'braces ("{a,b}") or one entry per alternative'
1081
+ : `"${glob.replace(group[0], names.length === 1 ? names[0]! : `{${names.join(',')}}`)}"`
1082
+ throw new UserError(
1083
+ `${where}: "${glob}" is an extglob, which vx's glob engine reads as literal text or a ` +
1084
+ `plain wildcard, never as the alternatives it lists, so the cache key would miss the ` +
1085
+ `files it names. Write ${rewrite} instead.`,
1086
+ )
1087
+ }
1069
1088
  }
1070
1089
 
1071
1090
  /**
@@ -4,6 +4,7 @@ import path from 'node:path'
4
4
  import type { ProjectConfig, WorkspaceConfig } from '../config.js'
5
5
  import {
6
6
  BUN_GLOB_WILDCARDS,
7
+ EXTGLOB,
7
8
  isOutOfFds,
8
9
  isPermissionError,
9
10
  relPosix,
@@ -323,16 +324,6 @@ function assertGlobList(value: unknown, file: string, field: string): string[] {
323
324
  return value as string[]
324
325
  }
325
326
 
326
- /**
327
- * An extglob group: `!(…)`, `@(…)`, `+(…)`, `*(…)`, `?(…)`. npm (minimatch)
328
- * and yarn (micromatch) read `packages/!(x)` as "every directory in
329
- * packages/ but x"; `Bun.Glob` has no extglob, and its scan read the
330
- * segment as a wildcard, so the excluded package became a project
331
- * (turborepo#3766) while its match read the same text literally. vx cannot
332
- * honour the pattern, so it refuses it rather than read it either way.
333
- */
334
- const EXTGLOB = /[!@+*?]\(/
335
-
336
327
  function extglobRefusal(pattern: string, file: string, field: string): UserError {
337
328
  const head = `${file}: \`${field}\` entry "${pattern}" is an extglob, which vx's glob engine does not read`
338
329
  // The common shape, a whole segment excluding plain names, has an exact