@vzn/vx 0.0.526 → 0.0.527
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 +5 -5
- package/src/workspace/workspace.ts +20 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.527",
|
|
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.
|
|
25
|
-
"@vzn/vx-linux-arm64": "0.0.
|
|
26
|
-
"@vzn/vx-darwin-x64": "0.0.
|
|
27
|
-
"@vzn/vx-darwin-arm64": "0.0.
|
|
24
|
+
"@vzn/vx-linux-x64": "0.0.527",
|
|
25
|
+
"@vzn/vx-linux-arm64": "0.0.527",
|
|
26
|
+
"@vzn/vx-darwin-x64": "0.0.527",
|
|
27
|
+
"@vzn/vx-darwin-arm64": "0.0.527"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/sandbox-runtime": "^0.0.76"
|
|
@@ -74,7 +74,9 @@ const decoder = new TextDecoder()
|
|
|
74
74
|
* `^task` edges vanish, upstream hashes drop out of the cache key (stale
|
|
75
75
|
* hits), and a second cache dir appears under the member. Claiming is decided
|
|
76
76
|
* with the same globs `loadWorkspace` applies, so "the root that claims me"
|
|
77
|
-
* and "the root that lists me as a project" cannot diverge.
|
|
77
|
+
* and "the root that lists me as a project" cannot diverge. An outer root
|
|
78
|
+
* that lists both the claimer and the claimed member outranks the claimer:
|
|
79
|
+
* from the claimer's own directory the walk reaches the outer root too.
|
|
78
80
|
*
|
|
79
81
|
* When no candidate claims `start` — a standalone package, or a subdirectory
|
|
80
82
|
* of a single-project repo — the nearest candidate wins (the root itself IS
|
|
@@ -92,6 +94,9 @@ export async function findWorkspaceRoot(
|
|
|
92
94
|
// The nearest manifest with workspace globs of its own, once passed: an
|
|
93
95
|
// outer root claims the tree only by listing this directory itself.
|
|
94
96
|
let inner: string | null = null
|
|
97
|
+
// The root that claims `start`, and the members it claimed it through.
|
|
98
|
+
let claimed: string | null = null
|
|
99
|
+
let members: string[] = []
|
|
95
100
|
while (true) {
|
|
96
101
|
let globs: string[] | null
|
|
97
102
|
try {
|
|
@@ -105,12 +110,23 @@ export async function findWorkspaceRoot(
|
|
|
105
110
|
}
|
|
106
111
|
if (globs !== null) {
|
|
107
112
|
nearest ??= dir
|
|
108
|
-
if (
|
|
113
|
+
if (claimed !== null) {
|
|
114
|
+
// An outer root that lists both the claimer and the member owns
|
|
115
|
+
// them: `packages/**` holding `packages/inner` (with `workspaces:
|
|
116
|
+
// ['sub']`) and `packages/inner/sub` resolved `sub` to `inner` and
|
|
117
|
+
// `inner` to the outer root, two roots and two keys for one tree.
|
|
118
|
+
if (claimsMember(dir, [claimed], globs) && claimsMember(dir, members, globs)) claimed = dir
|
|
119
|
+
} else if (claimsMember(dir, inner === null ? below : [inner], globs)) {
|
|
120
|
+
claimed = dir
|
|
121
|
+
members = inner === null ? [...below] : [inner]
|
|
122
|
+
}
|
|
109
123
|
// pnpm takes the nearest `pnpm-workspace.yaml` as the root, listed or
|
|
110
124
|
// not. Walking past it, `apps/inner` resolved to the outer workspace
|
|
111
125
|
// while `apps/inner/pkgs/x` resolved to the inner one: two roots and
|
|
112
126
|
// two caches for one tree (item 990). Already read: `reads` holds it.
|
|
113
|
-
if ((await readOnce(reads, path.join(dir, 'pnpm-workspace.yaml'))) !== null)
|
|
127
|
+
if ((await readOnce(reads, path.join(dir, 'pnpm-workspace.yaml'))) !== null) {
|
|
128
|
+
return claimed ?? dir
|
|
129
|
+
}
|
|
114
130
|
}
|
|
115
131
|
const parent = path.dirname(dir)
|
|
116
132
|
if (parent === dir) break
|
|
@@ -126,6 +142,7 @@ export async function findWorkspaceRoot(
|
|
|
126
142
|
if (inner === null && globs !== null && globs.length > 0) inner = dir
|
|
127
143
|
dir = parent
|
|
128
144
|
}
|
|
145
|
+
if (claimed !== null) return claimed
|
|
129
146
|
if (nearest !== null) return nearest
|
|
130
147
|
throw new UserError(
|
|
131
148
|
`Could not find a workspace root in any parent of ${start} ` +
|