crewforth 3.2.0-rc.7 → 3.2.0-rc.8
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/CHANGELOG.md +5 -0
- package/VERSION +1 -1
- package/kit/eval/lib/crew-map/surface.mjs +19 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -220,6 +220,11 @@ versioning follows [SemVer](https://semver.org/).
|
|
|
220
220
|
|
|
221
221
|
### Fixed
|
|
222
222
|
|
|
223
|
+
- **Crew Map reads a `fetch` call's method from its own options only.** The method was taken from the next four
|
|
224
|
+
lines, so in a file of one-line calls a `{ method: 'POST' }` on a later call was given to the earlier ones, and the
|
|
225
|
+
map reported `POST /api/products is called but no endpoint in this repo provides it` (endpoint-missing) for a
|
|
226
|
+
plain `fetch('/api/products')`. The scan now reads the call's arguments up to its own closing parenthesis, over
|
|
227
|
+
strings and nested brackets; a method on a later line of the same call is still read.
|
|
223
228
|
- **A push approval covers a tag on the approved commit.** `git push <remote> <tag>` had no way to be approved: the
|
|
224
229
|
click and `/crew-approve push` both record a push of the branch, and the tag push of a release was refused after
|
|
225
230
|
either, so the session handed the user the command to run. It now passes when the tag points at the commit the
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.2.0-rc.
|
|
1
|
+
3.2.0-rc.8
|
|
@@ -270,6 +270,24 @@ function firstArg(L, i, from) {
|
|
|
270
270
|
}
|
|
271
271
|
return null;
|
|
272
272
|
}
|
|
273
|
+
// The arguments of a call whose `(` ends at `from` on line i, up to its own `)`, across at most four lines: strings
|
|
274
|
+
// and nested brackets are stepped over, so `method:` is read from this call's options and never from the next call's.
|
|
275
|
+
function callArgs(L, i, from) {
|
|
276
|
+
let out = ''; let depth = 0; let q = null;
|
|
277
|
+
for (let j = i; j < Math.min(L.length, i + 4); j++) {
|
|
278
|
+
const s = j === i ? L[i].slice(from) : L[j];
|
|
279
|
+
for (let k = 0; k < s.length; k++) {
|
|
280
|
+
const c = s[k];
|
|
281
|
+
if (q) { if (c === '\\') { out += c + (s[k + 1] ?? ''); k += 1; continue; } if (c === q) q = null; }
|
|
282
|
+
else if (c === '"' || c === "'" || c === '`') q = c;
|
|
283
|
+
else if (c === '(' || c === '[' || c === '{') depth += 1;
|
|
284
|
+
else if (c === ')' || c === ']' || c === '}') { if (depth === 0) return out; depth -= 1; }
|
|
285
|
+
out += c;
|
|
286
|
+
}
|
|
287
|
+
out += ' ';
|
|
288
|
+
}
|
|
289
|
+
return out;
|
|
290
|
+
}
|
|
273
291
|
// The names a module calls HTTP through: axios, and every `x = axios.create(…)` in any of its files (a client made
|
|
274
292
|
// in lib/api.ts is called from every component). A name a file itself makes a server of is not one there.
|
|
275
293
|
function httpClients(pj, m) {
|
|
@@ -358,8 +376,7 @@ export function endpoints(pj, st, out) {
|
|
|
358
376
|
if (nm && nest !== null) add(provides, m, nm[1] === 'All' ? '*' : nm[1], join(nest, nm[2] || ''), f, i, `@${nm[1]}`);
|
|
359
377
|
const fe = /\bfetch\(\s*(['"`])([^'"`]+)\1/.exec(l);
|
|
360
378
|
if (fe && !/^https?:/.test(fe[2])) {
|
|
361
|
-
const
|
|
362
|
-
const mt = /method\s*:\s*['"](\w+)['"]/.exec(win);
|
|
379
|
+
const mt = /method\s*:\s*['"](\w+)['"]/.exec(callArgs(L, i, fe.index + l.slice(fe.index).indexOf('(') + 1));
|
|
363
380
|
add(consumes, m, mt ? mt[1] : 'GET', fe[2], f, i, fe[2]);
|
|
364
381
|
}
|
|
365
382
|
// `api.get<User[]>("/x")` and a call whose path is on the next line read alike.
|
package/package.json
CHANGED