@astryxdesign/cli 0.7.11-canary.84a2254 → 0.7.11-canary.9782dea
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/foundation/env/semver.mjs +41 -9
- package/package.json +6 -6
|
@@ -80,7 +80,10 @@ export function semverGt(a, b) {
|
|
|
80
80
|
* @returns {{major: number, minor: number, patch: number, count: number}}
|
|
81
81
|
*/
|
|
82
82
|
function parseVersionParts(value) {
|
|
83
|
-
const core = String(value)
|
|
83
|
+
const core = String(value)
|
|
84
|
+
.trim()
|
|
85
|
+
.replace(/^[v=]+/, '')
|
|
86
|
+
.split(/[-+]/)[0];
|
|
84
87
|
const nums = core.split('.').map(n => parseInt(n, 10));
|
|
85
88
|
return {
|
|
86
89
|
major: Number.isFinite(nums[0]) ? nums[0] : 0,
|
|
@@ -105,7 +108,8 @@ function satisfiesComparator(version, token) {
|
|
|
105
108
|
if (!m) return true;
|
|
106
109
|
const op = m[1] || '=';
|
|
107
110
|
const target = m[2].trim();
|
|
108
|
-
if (target === '' || target === '*' || target.toLowerCase() === 'x')
|
|
111
|
+
if (target === '' || target === '*' || target.toLowerCase() === 'x')
|
|
112
|
+
return true;
|
|
109
113
|
const t = parseVersionParts(target);
|
|
110
114
|
// No numeric component (e.g. `workspace:*`, a git/url spec) — can't model it,
|
|
111
115
|
// so treat as unconstrained rather than emit a false mismatch.
|
|
@@ -123,16 +127,22 @@ function satisfiesComparator(version, token) {
|
|
|
123
127
|
case '<':
|
|
124
128
|
return cmp < 0;
|
|
125
129
|
case '^':
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
// A partial target widens the range to the parts given: `^0` is any
|
|
131
|
+
// 0.x.y, `^0.0` is any 0.0.y, while `^0.0.3` is locked to the patch.
|
|
132
|
+
if (t.major > 0 || t.count === 1) return below(`${t.major + 1}.0.0`);
|
|
133
|
+
if (t.minor > 0 || t.count === 2) return below(`0.${t.minor + 1}.0`);
|
|
128
134
|
return below(`0.0.${t.patch + 1}`);
|
|
129
135
|
case '~':
|
|
130
|
-
return below(
|
|
136
|
+
return below(
|
|
137
|
+
t.count >= 2 ? `${t.major}.${t.minor + 1}.0` : `${t.major + 1}.0.0`,
|
|
138
|
+
);
|
|
131
139
|
case '=':
|
|
132
140
|
default:
|
|
133
141
|
// A full version is exact; a partial (`1`, `1.2`) behaves like a range.
|
|
134
142
|
if (t.count >= 3) return cmp === 0;
|
|
135
|
-
return below(
|
|
143
|
+
return below(
|
|
144
|
+
t.count === 2 ? `${t.major}.${t.minor + 1}.0` : `${t.major + 1}.0.0`,
|
|
145
|
+
);
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
148
|
|
|
@@ -154,11 +164,33 @@ function satisfiesComparator(version, token) {
|
|
|
154
164
|
export function satisfiesRange(version, range) {
|
|
155
165
|
if (!isValidSemver(version)) return true;
|
|
156
166
|
const r = String(range ?? '').trim();
|
|
157
|
-
if (
|
|
167
|
+
if (
|
|
168
|
+
r === '' ||
|
|
169
|
+
r === '*' ||
|
|
170
|
+
r.toLowerCase() === 'x' ||
|
|
171
|
+
r.toLowerCase() === 'latest'
|
|
172
|
+
) {
|
|
158
173
|
return true;
|
|
159
174
|
}
|
|
160
175
|
return r.split('||').some(union => {
|
|
161
|
-
|
|
162
|
-
|
|
176
|
+
// A hyphen range `A - B` is the inclusive intersection `>=A <=B`; left
|
|
177
|
+
// as-is its two bare versions would each read as an exact match that
|
|
178
|
+
// can never both hold. A partial upper bound covers its whole series, as
|
|
179
|
+
// npm reads it: `1.0.0 - 2` is `>=1.0.0 <3.0.0`.
|
|
180
|
+
const normalized = union
|
|
181
|
+
.trim()
|
|
182
|
+
.replace(/^(\S+)\s+-\s+(\S+)$/, (_, low, high) => {
|
|
183
|
+
const h = parseVersionParts(high);
|
|
184
|
+
if (h.count === 0) return `>=${low}`;
|
|
185
|
+
if (h.count >= 3) return `>=${low} <=${high}`;
|
|
186
|
+
const next =
|
|
187
|
+
h.count === 2 ? `${h.major}.${h.minor + 1}.0` : `${h.major + 1}.0.0`;
|
|
188
|
+
return `>=${low} <${next}`;
|
|
189
|
+
});
|
|
190
|
+
const tokens = normalized.split(/\s+/).filter(Boolean);
|
|
191
|
+
return (
|
|
192
|
+
tokens.length === 0 ||
|
|
193
|
+
tokens.every(tok => satisfiesComparator(version, tok))
|
|
194
|
+
);
|
|
163
195
|
});
|
|
164
196
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.11-canary.
|
|
3
|
+
"version": "0.7.11-canary.9782dea",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"zod": "^4.4.3"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
|
-
"@astryxdesign/core": "0.7.11-canary.
|
|
127
|
+
"@astryxdesign/core": "0.7.11-canary.9782dea"
|
|
128
128
|
},
|
|
129
129
|
"peerDependenciesMeta": {
|
|
130
130
|
"@astryxdesign/core": {
|
|
@@ -132,10 +132,10 @@
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
"devDependencies": {
|
|
135
|
-
"@astryxdesign/charts": "0.7.11-canary.
|
|
136
|
-
"@astryxdesign/core": "0.7.11-canary.
|
|
137
|
-
"@astryxdesign/lab": "0.7.11-canary.
|
|
138
|
-
"@astryxdesign/theme-neutral": "0.7.11-canary.
|
|
135
|
+
"@astryxdesign/charts": "0.7.11-canary.9782dea",
|
|
136
|
+
"@astryxdesign/core": "0.7.11-canary.9782dea",
|
|
137
|
+
"@astryxdesign/lab": "0.7.11-canary.9782dea",
|
|
138
|
+
"@astryxdesign/theme-neutral": "0.7.11-canary.9782dea",
|
|
139
139
|
"@heroicons/react": "^2.2.0",
|
|
140
140
|
"@stylexjs/stylex": "^0.19.0",
|
|
141
141
|
"@types/babel__core": "^7.20.5",
|