@vzn/vx 0.0.158 → 0.0.159

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.158",
3
+ "version": "0.0.159",
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.158",
21
- "@vzn/vx-linux-arm64": "0.0.158",
22
- "@vzn/vx-darwin-x64": "0.0.158",
23
- "@vzn/vx-darwin-arm64": "0.0.158"
20
+ "@vzn/vx-linux-x64": "0.0.159",
21
+ "@vzn/vx-linux-arm64": "0.0.159",
22
+ "@vzn/vx-darwin-x64": "0.0.159",
23
+ "@vzn/vx-darwin-arm64": "0.0.159"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -531,6 +531,7 @@ export function validateProjectConfig(config: ProjectConfig, configPath: string)
531
531
  `let cleanOutputs delete files outside it)`,
532
532
  )
533
533
  }
534
+ assertNoForeignToken(g, `${where}.cache.outputs.files`)
534
535
  if (namesDirItself(g)) {
535
536
  throw new UserError(
536
537
  `${where}.cache.outputs.files: "${g}" names the project directory itself and selects nothing — ` +
@@ -568,6 +569,7 @@ export function validateProjectConfig(config: ProjectConfig, configPath: string)
568
569
  `use cache.inputs.workspaceFiles for workspace-root-relative inputs)`,
569
570
  )
570
571
  }
572
+ assertNoForeignToken(g, `${where}.cache.inputs.files`)
571
573
  if (namesDirItself(g)) {
572
574
  throw new UserError(
573
575
  `${where}.cache.inputs.files: "${g}" names the project directory itself and selects nothing — use "**" for everything under it`,
@@ -823,6 +825,36 @@ function ownFileCovered(glob: string, configPath: string): string | null {
823
825
  return ['package.json', path.basename(configPath)].find((f) => g.match(f)) ?? null
824
826
  }
825
827
 
828
+ /**
829
+ * Turbo's and Nx's glob tokens, pasted from turbo.json or project.json
830
+ * (D-50). vx expands none of them, so each is a literal that matches no
831
+ * file: an input list of `$TURBO_DEFAULT$` keyed the task on nothing and
832
+ * replayed a stale output after its source changed.
833
+ */
834
+ const FOREIGN_TOKENS: readonly (readonly [string, string])[] = [
835
+ [
836
+ '$TURBO_DEFAULT$',
837
+ 'Turbo\'s default input set, which vx does not have — list the files, such as "**" for everything in the project',
838
+ ],
839
+ [
840
+ '$TURBO_ROOT$',
841
+ "Turbo's workspace root — name the path without it in `workspaceFiles`, which is workspace-root-relative",
842
+ ],
843
+ ['{projectRoot}', "Nx's project root — drop it: `files` globs are project-relative already"],
844
+ [
845
+ '{workspaceRoot}',
846
+ "Nx's workspace root — name the path without it in `workspaceFiles`, which is workspace-root-relative",
847
+ ],
848
+ ]
849
+
850
+ function assertNoForeignToken(glob: string, where: string): void {
851
+ for (const [token, meaning] of FOREIGN_TOKENS) {
852
+ if (glob.includes(token)) {
853
+ throw new UserError(`${where}: "${glob}" holds ${token}, ${meaning}`)
854
+ }
855
+ }
856
+ }
857
+
826
858
  /**
827
859
  * `.`, `./`, `././` (with or without a `!`) name the directory itself, which
828
860
  * no matcher expands: the entry selected nothing and said so nowhere.
@@ -1032,6 +1064,7 @@ function validateWorkspaceGlobs(v: unknown, where: string, negation: boolean): v
1032
1064
  `entries are workspace-root-relative and must stay within the workspace root`,
1033
1065
  )
1034
1066
  }
1067
+ assertNoForeignToken(g, where)
1035
1068
  if (namesDirItself(g)) {
1036
1069
  throw new UserError(
1037
1070
  `${where}: "${g}" names the workspace root itself and selects nothing — use "**" for everything under it`,