@vzn/vx 0.0.479 → 0.0.480

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.479",
3
+ "version": "0.0.480",
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.479",
25
- "@vzn/vx-linux-arm64": "0.0.479",
26
- "@vzn/vx-darwin-x64": "0.0.479",
27
- "@vzn/vx-darwin-arm64": "0.0.479"
24
+ "@vzn/vx-linux-x64": "0.0.480",
25
+ "@vzn/vx-linux-arm64": "0.0.480",
26
+ "@vzn/vx-darwin-x64": "0.0.480",
27
+ "@vzn/vx-darwin-arm64": "0.0.480"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -571,12 +571,16 @@ export function validateProjectConfig(config: ProjectConfig, configPath: string)
571
571
  // A `!` entry takes a path back from the outputs (A-44): it is not
572
572
  // cleaned, saved or restored, and it stays an input.
573
573
  assertNotDoubleNegated(g, `${where}.cache.outputs.files`)
574
- const own = g.startsWith('!') ? null : ownFileCovered(g, configPath)
575
- if (own !== null) {
574
+ // Taken back by a `!`, the file is never cleaned or restored.
575
+ const own = g.startsWith('!')
576
+ ? undefined
577
+ : ownFilesCovered(g, configPath).find((f) => !takenBack(outFiles as unknown[], f))
578
+ if (own !== undefined) {
576
579
  throw new UserError(
577
580
  `${where}.cache.outputs.files: "${g}" covers the project's own ${own} — vx deletes a ` +
578
581
  `task's outputs before it runs and restores them on a hit, so the project would lose ` +
579
- `its manifest and config. Name the directory the task writes, such as "dist/**".`,
582
+ `its manifest and config. Name the directory the task writes, such as "dist/**", ` +
583
+ `or take the file back with "!${own}".`,
580
584
  )
581
585
  }
582
586
  }
@@ -953,9 +957,18 @@ function assertTimeoutInRange(ms: number, where: string): void {
953
957
  * `package.json` and `vx.config` while the run reported success (item
954
958
  * 1002); the message for `'.'` had even suggested `**`.
955
959
  */
956
- function ownFileCovered(glob: string, configPath: string): string | null {
960
+ function ownFilesCovered(glob: string, configPath: string): string[] {
957
961
  const g = new Bun.Glob(normalizeGlob(glob))
958
- return ['package.json', path.basename(configPath)].find((f) => g.match(f)) ?? null
962
+ return ['package.json', path.basename(configPath)].filter((f) => g.match(f))
963
+ }
964
+
965
+ function takenBack(globs: readonly unknown[], file: string): boolean {
966
+ return globs.some(
967
+ (n) =>
968
+ typeof n === 'string' &&
969
+ n.startsWith('!') &&
970
+ new Bun.Glob(normalizeGlob(n.slice(1))).match(file),
971
+ )
959
972
  }
960
973
 
961
974
  /**