@akanjs/cli 3.1.2-rc.2 → 3.1.2-rc.4
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/.build-stamp +1 -1
- package/{CodeAgent-nkk70v5h.js → CodeAgent-z34p8m91.js} +2 -2
- package/{CodeTui-sdqz2gxb.js → CodeTui-nvd9fk3g.js} +1 -1
- package/TunnelShare-jwbb50kz.js +14 -0
- package/{agent.command-5gfrfh8d.js → agent.command-962mp3kg.js} +15 -15
- package/akanCode.js +2 -2
- package/{application.command-nd0fshsk.js → application.command-1nr0bqq1.js} +35 -11
- package/{applicationBuildRunner-s13x3zqb.js → applicationBuildRunner-xy7hnfzq.js} +7 -6
- package/buildBatch.proc.js +6 -6
- package/{cloud.command-8kbddsz9.js → cloud.command-cj7b3m6y.js} +15 -15
- package/cloud.script-8kr7qgfa.js +27 -0
- package/{code.command-5djp5c0n.js → code.command-asq7xrr6.js} +6 -6
- package/commandManifest.json +1 -1
- package/{context.command-5d0bscv6.js → context.command-fw4g2pw1.js} +18 -17
- package/context.runner-p6m5cxk3.js +28 -0
- package/{guideline.command-195g0h9a.js → guideline.command-43gfjsjv.js} +2 -2
- package/guidelines/conventions/rules/page.md +4 -2
- package/guidelines/conventions/rules/server.md +2 -0
- package/guidelines/conventions/rules/style.md +3 -1
- package/guidelines/conventions/rules/ts.md +2 -1
- package/guidelines/cssRule/cssRule.instruction.md +3 -1
- package/guidelines/pageRule/pageRule.instruction.md +3 -0
- package/incrementalBuilder.proc.js +52 -6
- package/{index-ms1am2wr.js → index-0tkj05cz.js} +3 -3
- package/{index-00a7j05x.js → index-2yan1ajk.js} +7 -7
- package/{index-g500c5j9.js → index-38by07nw.js} +1 -1
- package/{index-zttm13c3.js → index-38patcx6.js} +4 -4
- package/{index-f6zrhcnk.js → index-53h0053j.js} +23 -8
- package/{index-zbrwnmf1.js → index-6t7fkx73.js} +1 -1
- package/{index-pqdyyxz0.js → index-6zgt7zmx.js} +4 -4
- package/{index-y4kcmbt2.js → index-8d9r465x.js} +2 -2
- package/{index-yep9xcz0.js → index-90q0w90q.js} +1 -1
- package/{index-q9q6jjk1.js → index-ampz4vgv.js} +4 -4
- package/{index-chjaw222.js → index-ap6ac70m.js} +3 -3
- package/{index-dbxac7mz.js → index-ck64kxrn.js} +2 -2
- package/{index-p6x5b7hr.js → index-d894868w.js} +3 -0
- package/{index-sveq36gh.js → index-dcm66hss.js} +2 -2
- package/{index-84h43kg6.js → index-demt944k.js} +2 -2
- package/{index-0j1t1h2b.js → index-g0yds382.js} +1 -1
- package/{index-pnk67cqd.js → index-gfh90r3t.js} +2 -2
- package/{index-19cspack.js → index-hmj94es2.js} +4 -4
- package/{index-3q4kkyd4.js → index-jzpeny42.js} +3 -3
- package/{index-tw27n941.js → index-jzz6ye8x.js} +296 -24
- package/{index-2mwjshz5.js → index-kc6ffq0s.js} +16 -13
- package/{index-tp56652m.js → index-kc871vpc.js} +3 -3
- package/{index-1404hqcj.js → index-kdswbvys.js} +3 -3
- package/{index-defp4gmb.js → index-qev8p5wp.js} +1 -1
- package/{index-1h2jc0x3.js → index-qwe079ww.js} +4 -4
- package/{index-wwe9rsrx.js → index-r0a604h4.js} +12 -2
- package/{index-9zy8479y.js → index-r0q2ka2b.js} +1 -1
- package/{index-ewbmfarf.js → index-r8t5sq7z.js} +31 -8
- package/{index-gf4fcw1n.js → index-re2kfscb.js} +495 -8
- package/{index-gr9thy79.js → index-sra1a5f8.js} +2 -2
- package/{index-khk05tsf.js → index-t0hk1kxq.js} +1 -1
- package/index-vkpqe29t.js +267 -0
- package/{index-sp0qsr7a.js → index-w60zxxye.js} +3 -3
- package/{index-mzjwq4dd.js → index-wymcdsas.js} +8 -8
- package/{index-t78230d7.js → index-y0y0pnx8.js} +3 -2
- package/{index-tyt7cw99.js → index-z47rw9ez.js} +6 -6
- package/index.js +23 -23
- package/{library.command-63hgt9te.js → library.command-zh29tjdd.js} +3 -3
- package/{localRegistry.command-g3f8k25t.js → localRegistry.command-k9pn9ahj.js} +14 -14
- package/{module.command-myykfb6s.js → module.command-dgpqs9fz.js} +6 -6
- package/{package.command-96eheyvd.js → package.command-1je4hsca.js} +3 -3
- package/package.json +2 -2
- package/{page.command-gs6d841d.js → page.command-cgsasanh.js} +3 -3
- package/{pipeline.command-wdfvdbfj.js → pipeline.command-tb46sa8v.js} +2 -2
- package/{primitive.command-eg2c3m97.js → primitive.command-bzsy23x5.js} +7 -7
- package/{projectTypecheck-kqj1t6hb.js → projectTypecheck-h8rgaczy.js} +1 -1
- package/{quality.command-b840977n.js → quality.command-120m9h6v.js} +4 -4
- package/{repair.command-r7z709yf.js → repair.command-6m4wd0qv.js} +6 -6
- package/{scalar.command-t6hhty3f.js → scalar.command-3dn5hsc6.js} +5 -5
- package/skills/akan-page/SKILL.md +19 -0
- package/skills/akan-service/SKILL.md +47 -0
- package/{subspace.command-a1sf9n5a.js → subspace.command-s8nyfqbn.js} +8 -8
- package/{tunnel.command-dcb0wg93.js → tunnel.command-8mwrqkr3.js} +7 -7
- package/{typeChecker-j2jdnqsr.js → typeChecker-s640r6c0.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/{verify.command-07fqhpak.js → verify.command-2pspfy7k.js} +12 -12
- package/{workflow.command-c2jhzf7v.js → workflow.command-7sy5vnsj.js} +11 -11
- package/{workspace.command-gv20zq1z.js → workspace.command-x518tdv4.js} +30 -29
- package/TunnelShare-hdq9h1hr.js +0 -14
- package/cloud.script-hgvvajm3.js +0 -27
- package/context.runner-2v5pq18d.js +0 -27
- package/templates/workspaceRoot/patches/zod@3.25.76.patch.template +0 -22
- package/templates/workspaceRoot/patches/zod@4.4.3.patch.template +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ApplicationBuildReporter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-d894868w.js";
|
|
5
5
|
import {
|
|
6
6
|
parseBiomeReport,
|
|
7
7
|
Linter,
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
AppExecutor,
|
|
11
11
|
LibExecutor,
|
|
12
12
|
PkgExecutor
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-38by07nw.js";
|
|
14
14
|
import {
|
|
15
15
|
WorkspaceRunner,
|
|
16
16
|
AkanQualityScanner
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-ap6ac70m.js";
|
|
18
18
|
|
|
19
19
|
// pkgs/@akanjs/cli/verify/verifyComments.ts
|
|
20
20
|
import { existsSync } from "fs";
|
|
@@ -184,10 +184,12 @@ class VerifyComments {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// pkgs/@akanjs/cli/verify/verifyPipeline.ts
|
|
187
|
-
import { existsSync as
|
|
188
|
-
import
|
|
187
|
+
import { existsSync as existsSync4 } from "fs";
|
|
188
|
+
import path5 from "path";
|
|
189
189
|
|
|
190
190
|
// pkgs/@akanjs/cli/verify/verifyDiagnostics.ts
|
|
191
|
+
import path2 from "path";
|
|
192
|
+
|
|
191
193
|
class VerifyDiagnostics {
|
|
192
194
|
static fromTypecheck(records) {
|
|
193
195
|
return records.map((record) => {
|
|
@@ -221,15 +223,31 @@ class VerifyDiagnostics {
|
|
|
221
223
|
};
|
|
222
224
|
}
|
|
223
225
|
static fromBiome(report) {
|
|
224
|
-
return (report.diagnostics ?? []).filter((diagnostic) => diagnostic.severity === "error" || diagnostic.severity === "warning").map((diagnostic) =>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
226
|
+
return (report.diagnostics ?? []).filter((diagnostic) => diagnostic.severity === "error" || diagnostic.severity === "warning").map((diagnostic) => {
|
|
227
|
+
const file = diagnostic.location?.path?.replaceAll("\\", "/") ?? null;
|
|
228
|
+
return {
|
|
229
|
+
step: "lint",
|
|
230
|
+
file,
|
|
231
|
+
line: diagnostic.location?.start?.line ?? 0,
|
|
232
|
+
col: diagnostic.location?.start?.column ?? 0,
|
|
233
|
+
code: diagnostic.category ?? "biome",
|
|
234
|
+
severity: diagnostic.severity === "error" ? "error" : "warning",
|
|
235
|
+
...VerifyDiagnostics.#adapterErrorOf(file, diagnostic.message) ?? { message: diagnostic.message }
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
static #rawError = /^Do not (throw|construct) a raw `Error`/;
|
|
240
|
+
static #srvkitFile = /^((?:apps|libs)\/([\w-]+))\/srvkit\//;
|
|
241
|
+
static #adapterErrorOf(file, message) {
|
|
242
|
+
const [, verb] = message.match(VerifyDiagnostics.#rawError) ?? [];
|
|
243
|
+
const [, root, name] = file?.match(VerifyDiagnostics.#srvkitFile) ?? [];
|
|
244
|
+
if (!file || !verb || !root || !name)
|
|
245
|
+
return null;
|
|
246
|
+
const dict = path2.posix.relative(path2.posix.dirname(file), `${root}/lib/dict`);
|
|
247
|
+
return {
|
|
248
|
+
message: `Do not ${verb} a raw \`Error\`: an srvkit adapter uses \`Err\` with a key of the ${name} dictionary`,
|
|
249
|
+
fix: `import { Err } from "${dict}"; add <key>: [en, ko] to .error({}) in ${root}/lib/_${name}/${name}.dictionary.ts; ${verb === "throw" ? "throw " : ""}new Err("${name}.error.<key>")`
|
|
250
|
+
};
|
|
233
251
|
}
|
|
234
252
|
static fromMaintainability(entries) {
|
|
235
253
|
return entries.map((entry) => ({
|
|
@@ -272,6 +290,240 @@ class VerifyDiagnostics {
|
|
|
272
290
|
}
|
|
273
291
|
}
|
|
274
292
|
|
|
293
|
+
// pkgs/@akanjs/cli/verify/verifyPrivateMethods.ts
|
|
294
|
+
import { existsSync as existsSync2 } from "fs";
|
|
295
|
+
import path3 from "path";
|
|
296
|
+
|
|
297
|
+
class VerifyPrivateMethods {
|
|
298
|
+
static #moduleFile = /^(?:apps|libs)\/.+\.(?:constant|document|service|store)\.ts$/;
|
|
299
|
+
static #ignoredDirs = new Set(["node_modules", "dist", ".akan", "dump", "local"]);
|
|
300
|
+
static #typescriptLoad;
|
|
301
|
+
static #loadTypescript() {
|
|
302
|
+
VerifyPrivateMethods.#typescriptLoad ??= import("typescript").then((mod) => mod.default ?? mod);
|
|
303
|
+
return VerifyPrivateMethods.#typescriptLoad;
|
|
304
|
+
}
|
|
305
|
+
static async fix(root, dir, files) {
|
|
306
|
+
const candidates = (files.length ? files : await VerifyPrivateMethods.#moduleFilesIn(root, dir)).filter((file) => VerifyPrivateMethods.#moduleFile.test(file) && !VerifyPrivateMethods.#isIgnored(file) && existsSync2(path3.join(root, file)));
|
|
307
|
+
const rewritten = new Map;
|
|
308
|
+
for (const file of candidates) {
|
|
309
|
+
const absolute = path3.join(root, file);
|
|
310
|
+
const text = await Bun.file(absolute).text();
|
|
311
|
+
if (!text.includes("#"))
|
|
312
|
+
continue;
|
|
313
|
+
const typescript = await VerifyPrivateMethods.#loadTypescript();
|
|
314
|
+
if (!VerifyPrivateMethods.rewrite(typescript, file, text).renamed.length)
|
|
315
|
+
continue;
|
|
316
|
+
const beside = await VerifyPrivateMethods.#namesBeside(typescript, root, file);
|
|
317
|
+
const result = VerifyPrivateMethods.rewrite(typescript, file, text, beside);
|
|
318
|
+
if (!result.renamed.length)
|
|
319
|
+
continue;
|
|
320
|
+
await Bun.write(absolute, result.text);
|
|
321
|
+
rewritten.set(file, result.text);
|
|
322
|
+
}
|
|
323
|
+
return rewritten;
|
|
324
|
+
}
|
|
325
|
+
static async#moduleFilesIn(root, dir) {
|
|
326
|
+
if (!existsSync2(path3.join(root, dir)))
|
|
327
|
+
return [];
|
|
328
|
+
const files = [];
|
|
329
|
+
for await (const file of new Bun.Glob("**/*.{constant,document,service,store}.ts").scan({
|
|
330
|
+
cwd: path3.join(root, dir)
|
|
331
|
+
}))
|
|
332
|
+
files.push(path3.posix.join(dir, file.replaceAll("\\", "/")));
|
|
333
|
+
return files;
|
|
334
|
+
}
|
|
335
|
+
static #isIgnored(file) {
|
|
336
|
+
return file.split("/").some((segment) => VerifyPrivateMethods.#ignoredDirs.has(segment));
|
|
337
|
+
}
|
|
338
|
+
static async#namesBeside(typescript, root, file) {
|
|
339
|
+
const base = path3.posix.basename(file);
|
|
340
|
+
const pattern = base.endsWith(".store.ts") ? "{apps,libs}/**/*.store.ts" : `{apps,libs}/**/${base}`;
|
|
341
|
+
const names = new Set;
|
|
342
|
+
for await (const found of new Bun.Glob(pattern).scan({ cwd: root })) {
|
|
343
|
+
const other = found.replaceAll("\\", "/");
|
|
344
|
+
if (other === file || VerifyPrivateMethods.#isIgnored(other))
|
|
345
|
+
continue;
|
|
346
|
+
const text = await Bun.file(path3.join(root, other)).text();
|
|
347
|
+
const source = typescript.createSourceFile(other, text, typescript.ScriptTarget.Latest, false);
|
|
348
|
+
const visit = (node) => {
|
|
349
|
+
if (typescript.isClassLike(node)) {
|
|
350
|
+
for (const { name } of node.members)
|
|
351
|
+
if (name && (typescript.isIdentifier(name) || typescript.isPrivateIdentifier(name)))
|
|
352
|
+
names.add(name.text.replace(/^#/, ""));
|
|
353
|
+
}
|
|
354
|
+
typescript.forEachChild(node, visit);
|
|
355
|
+
};
|
|
356
|
+
visit(source);
|
|
357
|
+
}
|
|
358
|
+
return names;
|
|
359
|
+
}
|
|
360
|
+
static rewrite(typescript, fileName, text, beside = new Set) {
|
|
361
|
+
const source = typescript.createSourceFile(fileName, text, typescript.ScriptTarget.Latest, true, typescript.ScriptKind.TS);
|
|
362
|
+
const edits = [];
|
|
363
|
+
const renamed = [];
|
|
364
|
+
const visit = (node) => {
|
|
365
|
+
if (typescript.isClassLike(node))
|
|
366
|
+
renamed.push(...VerifyPrivateMethods.#renameIn(typescript, source, node, edits, beside));
|
|
367
|
+
typescript.forEachChild(node, visit);
|
|
368
|
+
};
|
|
369
|
+
visit(source);
|
|
370
|
+
if (!edits.length)
|
|
371
|
+
return { text, renamed };
|
|
372
|
+
const ordered = [...edits].sort((left, right) => right.start - left.start || right.end - left.end);
|
|
373
|
+
let rewritten = text;
|
|
374
|
+
for (const edit of ordered)
|
|
375
|
+
rewritten = rewritten.slice(0, edit.start) + edit.text + rewritten.slice(edit.end);
|
|
376
|
+
return { text: rewritten, renamed };
|
|
377
|
+
}
|
|
378
|
+
static #renameIn(typescript, source, cls, edits, beside) {
|
|
379
|
+
const methods = new Map;
|
|
380
|
+
const taken = new Set(beside);
|
|
381
|
+
for (const member of cls.members) {
|
|
382
|
+
if (typescript.isConstructorDeclaration(member)) {
|
|
383
|
+
for (const parameter of member.parameters)
|
|
384
|
+
if (typescript.getModifiers(parameter)?.length && typescript.isIdentifier(parameter.name))
|
|
385
|
+
taken.add(parameter.name.text);
|
|
386
|
+
}
|
|
387
|
+
const name = member.name;
|
|
388
|
+
if (!name)
|
|
389
|
+
continue;
|
|
390
|
+
if (typescript.isPrivateIdentifier(name)) {
|
|
391
|
+
if (typescript.isMethodDeclaration(member))
|
|
392
|
+
methods.set(name.text, [...methods.get(name.text) ?? [], member]);
|
|
393
|
+
} else if (typescript.isIdentifier(name) || typescript.isStringLiteral(name))
|
|
394
|
+
taken.add(name.text);
|
|
395
|
+
}
|
|
396
|
+
if (!methods.size)
|
|
397
|
+
return [];
|
|
398
|
+
const references = new Map;
|
|
399
|
+
const brandChecked = new Set;
|
|
400
|
+
const collect = (node, shadowed) => {
|
|
401
|
+
let inScope = shadowed;
|
|
402
|
+
if (node !== cls && typescript.isClassLike(node)) {
|
|
403
|
+
const own = node.members.flatMap((member) => member.name && typescript.isPrivateIdentifier(member.name) ? [member.name.text] : []);
|
|
404
|
+
if (own.length)
|
|
405
|
+
inScope = new Set([...shadowed, ...own]);
|
|
406
|
+
}
|
|
407
|
+
if (typescript.isPrivateIdentifier(node) && !inScope.has(node.text)) {
|
|
408
|
+
const parent = node.parent;
|
|
409
|
+
if (typescript.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === typescript.SyntaxKind.InKeyword)
|
|
410
|
+
brandChecked.add(node.text);
|
|
411
|
+
else if (typescript.isPropertyAccessExpression(parent) && parent.name === node)
|
|
412
|
+
references.set(node.text, [...references.get(node.text) ?? [], node]);
|
|
413
|
+
}
|
|
414
|
+
typescript.forEachChild(node, (child) => collect(child, inScope));
|
|
415
|
+
};
|
|
416
|
+
for (const member of cls.members)
|
|
417
|
+
collect(member, new Set);
|
|
418
|
+
const renamed = [];
|
|
419
|
+
for (const [privateName, declarations] of methods) {
|
|
420
|
+
const bare = privateName.slice(1);
|
|
421
|
+
if (taken.has(bare) || brandChecked.has(privateName))
|
|
422
|
+
continue;
|
|
423
|
+
for (const declaration of declarations) {
|
|
424
|
+
const firstModifier = typescript.getModifiers(declaration)?.[0];
|
|
425
|
+
const insertAt = (firstModifier ?? declaration.asteriskToken ?? declaration.name).getStart(source);
|
|
426
|
+
edits.push({ start: insertAt, end: insertAt, text: "private " });
|
|
427
|
+
edits.push({ start: declaration.name.getStart(source), end: declaration.name.getEnd(), text: bare });
|
|
428
|
+
}
|
|
429
|
+
for (const reference of references.get(privateName) ?? [])
|
|
430
|
+
edits.push({ start: reference.getStart(source), end: reference.getEnd(), text: bare });
|
|
431
|
+
renamed.push(privateName);
|
|
432
|
+
}
|
|
433
|
+
return renamed;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// pkgs/@akanjs/cli/verify/verifyStyleClasses.ts
|
|
438
|
+
import { existsSync as existsSync3 } from "fs";
|
|
439
|
+
import path4 from "path";
|
|
440
|
+
|
|
441
|
+
class VerifyStyleClasses {
|
|
442
|
+
static #message = "daisyUI legacy class";
|
|
443
|
+
static #grit = "node_modules/@akanjs/devkit/lint/no-daisyui-legacy-class.grit";
|
|
444
|
+
static #comment = /\/\*[\s\S]*?\*\//g;
|
|
445
|
+
static #classSelector = /\.((?:\\.|[\w-])+)/g;
|
|
446
|
+
static #utility = /@utility\s+([\w-]+)/g;
|
|
447
|
+
static #tokenSeparator = /[\s"'`{}()[\],]+/;
|
|
448
|
+
static legacyPatternOf(gritSource) {
|
|
449
|
+
const at = gritSource.indexOf(`message = "${VerifyStyleClasses.#message}`);
|
|
450
|
+
const open = at === -1 ? -1 : gritSource.lastIndexOf('r"', at);
|
|
451
|
+
if (open === -1)
|
|
452
|
+
return null;
|
|
453
|
+
let close = open + 2;
|
|
454
|
+
while (close < at && !(gritSource[close] === '"' && gritSource[close - 1] !== "\\"))
|
|
455
|
+
close += 1;
|
|
456
|
+
if (close >= at)
|
|
457
|
+
return null;
|
|
458
|
+
try {
|
|
459
|
+
return new RegExp(gritSource.slice(open + 2, close));
|
|
460
|
+
} catch {
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
static classesDefinedIn(css) {
|
|
465
|
+
const text = css.replace(VerifyStyleClasses.#comment, "");
|
|
466
|
+
const names = new Set;
|
|
467
|
+
for (const [, name] of text.matchAll(VerifyStyleClasses.#classSelector))
|
|
468
|
+
if (name)
|
|
469
|
+
names.add(name.replaceAll("\\", ""));
|
|
470
|
+
for (const [, name] of text.matchAll(VerifyStyleClasses.#utility))
|
|
471
|
+
if (name)
|
|
472
|
+
names.add(name);
|
|
473
|
+
return names;
|
|
474
|
+
}
|
|
475
|
+
static async dropDefined(root, diagnostics, cssDirs) {
|
|
476
|
+
const flagged = diagnostics.filter((diagnostic) => diagnostic.severity === "warning" && diagnostic.message.startsWith(VerifyStyleClasses.#message));
|
|
477
|
+
if (!flagged.length || !existsSync3(path4.join(root, VerifyStyleClasses.#grit)))
|
|
478
|
+
return diagnostics;
|
|
479
|
+
const pattern = VerifyStyleClasses.legacyPatternOf(await Bun.file(path4.join(root, VerifyStyleClasses.#grit)).text());
|
|
480
|
+
if (!pattern)
|
|
481
|
+
return diagnostics;
|
|
482
|
+
const defined = await VerifyStyleClasses.#definedClasses(root, cssDirs);
|
|
483
|
+
if (!defined.size)
|
|
484
|
+
return diagnostics;
|
|
485
|
+
const sources = new Map;
|
|
486
|
+
const dropped = new Set;
|
|
487
|
+
for (const diagnostic of flagged) {
|
|
488
|
+
const file = diagnostic.location?.path;
|
|
489
|
+
const { start, end } = diagnostic.location ?? {};
|
|
490
|
+
if (!file || !start?.line || !end?.line)
|
|
491
|
+
continue;
|
|
492
|
+
const absolute = path4.resolve(root, file);
|
|
493
|
+
if (!sources.has(absolute))
|
|
494
|
+
sources.set(absolute, existsSync3(absolute) ? (await Bun.file(absolute).text()).split(`
|
|
495
|
+
`) : []);
|
|
496
|
+
const span = VerifyStyleClasses.#linesOf(sources.get(absolute) ?? [], start.line, end.line);
|
|
497
|
+
const legacy = span.split(VerifyStyleClasses.#tokenSeparator).filter((token) => token && pattern.test(token));
|
|
498
|
+
if (legacy.length && legacy.every((token) => defined.has(VerifyStyleClasses.#classNameOf(token))))
|
|
499
|
+
dropped.add(diagnostic);
|
|
500
|
+
}
|
|
501
|
+
return dropped.size ? diagnostics.filter((diagnostic) => !dropped.has(diagnostic)) : diagnostics;
|
|
502
|
+
}
|
|
503
|
+
static #classNameOf(token) {
|
|
504
|
+
return token.replace(/^.*:/, "").replace(/^!|!$/g, "").replace(/\/.*$/, "");
|
|
505
|
+
}
|
|
506
|
+
static #linesOf(lines, start, end) {
|
|
507
|
+
return lines.slice(start - 1, end).join(`
|
|
508
|
+
`);
|
|
509
|
+
}
|
|
510
|
+
static async#definedClasses(root, dirs) {
|
|
511
|
+
const names = new Set;
|
|
512
|
+
for (const dir of new Set(dirs)) {
|
|
513
|
+
const cwd = path4.join(root, dir);
|
|
514
|
+
if (!existsSync3(cwd))
|
|
515
|
+
continue;
|
|
516
|
+
for await (const file of new Bun.Glob("**/*.css").scan({ cwd })) {
|
|
517
|
+
if (file.split(/[\\/]/).includes("node_modules"))
|
|
518
|
+
continue;
|
|
519
|
+
for (const name of VerifyStyleClasses.classesDefinedIn(await Bun.file(path4.join(cwd, file)).text()))
|
|
520
|
+
names.add(name);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return names;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
275
527
|
// pkgs/@akanjs/cli/verify/verifyPipeline.ts
|
|
276
528
|
class VerifyPipeline {
|
|
277
529
|
#workspace;
|
|
@@ -293,8 +545,11 @@ class VerifyPipeline {
|
|
|
293
545
|
if (!lintOnly)
|
|
294
546
|
await this.#each("sync", systems, (target) => this.#sync(target));
|
|
295
547
|
const synced = !this.#failed("sync");
|
|
548
|
+
const renames = new Map;
|
|
549
|
+
for (const target of systems)
|
|
550
|
+
renames.set(target, await VerifyPrivateMethods.fix(this.#root, target.dir, target.files).catch(() => new Map));
|
|
296
551
|
await Promise.all([
|
|
297
|
-
this.#each("lint", scope.targets, (target) => this.#lint(target, { comments: !lintOnly })),
|
|
552
|
+
this.#each("lint", scope.targets, (target) => this.#lint(target, { comments: !lintOnly, rewritten: renames.get(target) ?? new Map })),
|
|
298
553
|
lintOnly || !synced ? null : this.#each("typecheck", scope.targets, (target) => this.#typecheck(target))
|
|
299
554
|
]);
|
|
300
555
|
const apps = scope.targets.filter((target) => target.type === "app");
|
|
@@ -345,9 +600,10 @@ class VerifyPipeline {
|
|
|
345
600
|
await LibExecutor.from(this.#workspace, target.name).scan();
|
|
346
601
|
return { diagnostics: [] };
|
|
347
602
|
}
|
|
348
|
-
async#lint(target, { comments }) {
|
|
349
|
-
const files = target.files.length ? target.files.filter((file) =>
|
|
350
|
-
const biome = files.length ? await this.#biome(files) : { diagnostics: [], fixed: 0 };
|
|
603
|
+
async#lint(target, { comments, rewritten }) {
|
|
604
|
+
const files = target.files.length ? target.files.filter((file) => existsSync4(path5.join(this.#root, file))) : [target.dir];
|
|
605
|
+
const biome = files.length ? await this.#biome(files, VerifyPipeline.#cssDirsOf(target)) : { diagnostics: [], fixed: 0 };
|
|
606
|
+
const formattedAfter = await this.#changedSince(rewritten);
|
|
351
607
|
const exec = this.#execOf(target);
|
|
352
608
|
const gates = await this.#workspaceRunner.lintGateFailures(exec, true);
|
|
353
609
|
const added = comments && target.files.length ? await VerifyComments.added(this.#root, target.files) : [];
|
|
@@ -358,10 +614,22 @@ class VerifyPipeline {
|
|
|
358
614
|
...gates.messages.map((message) => VerifyDiagnostics.fromMessage("lint", message, "akan.lint")),
|
|
359
615
|
...VerifyDiagnostics.fromMaintainability(gates.maintainability)
|
|
360
616
|
],
|
|
361
|
-
fixed: biome.fixed
|
|
617
|
+
fixed: (biome.fixed ?? 0) + rewritten.size - formattedAfter
|
|
362
618
|
};
|
|
363
619
|
}
|
|
364
|
-
|
|
620
|
+
static #cssDirsOf(target) {
|
|
621
|
+
if (target.type === "pkg")
|
|
622
|
+
return [];
|
|
623
|
+
return target.type === "app" ? [target.dir, "libs"] : ["libs"];
|
|
624
|
+
}
|
|
625
|
+
async#changedSince(rewritten) {
|
|
626
|
+
let changed = 0;
|
|
627
|
+
for (const [file, text] of rewritten)
|
|
628
|
+
if (await Bun.file(path5.join(this.#root, file)).text() !== text)
|
|
629
|
+
changed += 1;
|
|
630
|
+
return changed;
|
|
631
|
+
}
|
|
632
|
+
async#biome(files, cssDirs) {
|
|
365
633
|
const configPath = await WorkspaceRunner.resolveBiomeConfigPath(this.#workspace);
|
|
366
634
|
const [biome, ...biomeArgs] = Linter.biomeCommand(this.#root);
|
|
367
635
|
const proc = Bun.spawn([
|
|
@@ -382,7 +650,11 @@ class VerifyPipeline {
|
|
|
382
650
|
]);
|
|
383
651
|
try {
|
|
384
652
|
const report = parseBiomeReport(stdout);
|
|
385
|
-
|
|
653
|
+
const diagnostics = await VerifyStyleClasses.dropDefined(this.#root, report.diagnostics ?? [], cssDirs);
|
|
654
|
+
return {
|
|
655
|
+
diagnostics: VerifyDiagnostics.fromBiome({ ...report, diagnostics }),
|
|
656
|
+
fixed: report.summary?.changed ?? 0
|
|
657
|
+
};
|
|
386
658
|
} catch {
|
|
387
659
|
return { diagnostics: [VerifyDiagnostics.fromMessage("lint", (stderr || stdout).trim(), "biome")] };
|
|
388
660
|
}
|
|
@@ -400,10 +672,10 @@ class VerifyPipeline {
|
|
|
400
672
|
report: "records"
|
|
401
673
|
});
|
|
402
674
|
else {
|
|
403
|
-
const tsconfigPath =
|
|
404
|
-
if (!
|
|
675
|
+
const tsconfigPath = path5.join(this.#root, target.dir, "tsconfig.json");
|
|
676
|
+
if (!existsSync4(tsconfigPath))
|
|
405
677
|
return { diagnostics: [] };
|
|
406
|
-
await new ProjectTypecheck2(
|
|
678
|
+
await new ProjectTypecheck2(path5.join(this.#root, target.dir), this.#root, process.env).check(tsconfigPath, "records");
|
|
407
679
|
}
|
|
408
680
|
return { diagnostics: [] };
|
|
409
681
|
} catch (error) {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
AppExecutor,
|
|
8
8
|
LibExecutor,
|
|
9
9
|
PkgExecutor
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-38by07nw.js";
|
|
11
11
|
import {
|
|
12
12
|
FileSys2
|
|
13
13
|
} from "./index-bns3wcpc.js";
|
|
@@ -46,28 +46,28 @@ import {
|
|
|
46
46
|
filesChangedSince,
|
|
47
47
|
HmrWatcher,
|
|
48
48
|
WatchRootResolver
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-d894868w.js";
|
|
50
50
|
import {
|
|
51
51
|
runner,
|
|
52
52
|
ExitCodeError,
|
|
53
53
|
assertPromptable
|
|
54
|
-
} from "./index-
|
|
54
|
+
} from "./index-r0q2ka2b.js";
|
|
55
55
|
import {
|
|
56
56
|
UpdatePackFolder,
|
|
57
57
|
UpdateUploader,
|
|
58
58
|
NativePublicEnv,
|
|
59
59
|
NativeApp
|
|
60
|
-
} from "./index-
|
|
60
|
+
} from "./index-w60zxxye.js";
|
|
61
61
|
import {
|
|
62
62
|
DesktopServerStage
|
|
63
|
-
} from "./index-
|
|
63
|
+
} from "./index-g0yds382.js";
|
|
64
64
|
import {
|
|
65
65
|
resolveMobileTargets,
|
|
66
66
|
resolveAppId
|
|
67
67
|
} from "./index-m9jj544v.js";
|
|
68
68
|
import {
|
|
69
69
|
SlicePlanner
|
|
70
|
-
} from "./index-
|
|
70
|
+
} from "./index-qev8p5wp.js";
|
|
71
71
|
import {
|
|
72
72
|
openBrowser
|
|
73
73
|
} from "./index-9dp031by.js";
|
|
@@ -331,6 +331,7 @@ import { MemoryLimit } from "akanjs/server/memoryLimit";
|
|
|
331
331
|
var builderMsgTypeSet = new Set([
|
|
332
332
|
"build-route-res",
|
|
333
333
|
"build-csr-res",
|
|
334
|
+
"build-graph-res",
|
|
334
335
|
"builder-ready",
|
|
335
336
|
"invalidate",
|
|
336
337
|
"css-updated",
|
|
@@ -422,7 +423,7 @@ class IncrementalBuilderHost {
|
|
|
422
423
|
return;
|
|
423
424
|
if (!msg || typeof msg !== "object")
|
|
424
425
|
return;
|
|
425
|
-
if (msg.type === "build-route-res" || msg.type === "build-csr-res")
|
|
426
|
+
if (msg.type === "build-route-res" || msg.type === "build-csr-res" || msg.type === "build-graph-res")
|
|
426
427
|
this.#inFlight.delete(msg.id);
|
|
427
428
|
if (builderMsgTypeSet.has(msg.type))
|
|
428
429
|
this.#onMessage(msg);
|
|
@@ -553,7 +554,7 @@ class IncrementalBuilderHost {
|
|
|
553
554
|
}
|
|
554
555
|
try {
|
|
555
556
|
this.#proc.send(message);
|
|
556
|
-
if (message.type === "build-route" || message.type === "build-csr")
|
|
557
|
+
if (message.type === "build-route" || message.type === "build-csr" || message.type === "build-graph")
|
|
557
558
|
this.#inFlight.set(message.id, message.type);
|
|
558
559
|
return true;
|
|
559
560
|
} catch (error) {
|
|
@@ -813,7 +814,7 @@ class DevBootLatch {
|
|
|
813
814
|
}
|
|
814
815
|
|
|
815
816
|
// pkgs/@akanjs/devkit/akanApp/akanApp.host.ts
|
|
816
|
-
var backendMsgTypeSet = new Set(["build-route", "build-csr"]);
|
|
817
|
+
var backendMsgTypeSet = new Set(["build-route", "build-csr", "build-graph"]);
|
|
817
818
|
var asMib = (bytes) => Math.round(bytes / 1024 / 1024);
|
|
818
819
|
var BACKEND_RESTART_DEBOUNCE_MS = 120;
|
|
819
820
|
var BACKEND_GRACEFUL_TIMEOUT_MS = 8000;
|
|
@@ -1235,7 +1236,7 @@ ${this.#backendStderrTail.join(`
|
|
|
1235
1236
|
await this.#handleInvalidate(message);
|
|
1236
1237
|
return;
|
|
1237
1238
|
}
|
|
1238
|
-
if (message.type === "build-route-res" || message.type === "build-csr-res") {
|
|
1239
|
+
if (message.type === "build-route-res" || message.type === "build-csr-res" || message.type === "build-graph-res") {
|
|
1239
1240
|
const answer = this.#builderRequests.settle(message);
|
|
1240
1241
|
if (!answer) {
|
|
1241
1242
|
this.logger.verbose(`[builder] dropped a ${message.type} no live backend is waiting for (id=${message.id})`);
|
|
@@ -1610,6 +1611,8 @@ ${this.#backendStderrTail.join(`
|
|
|
1610
1611
|
this.#sendToBackend({ type: "build-route-res", id: message.id, ok: false, error });
|
|
1611
1612
|
else if (message.type === "build-csr")
|
|
1612
1613
|
this.#sendToBackend({ type: "build-csr-res", id: message.id, ok: false, error });
|
|
1614
|
+
else if (message.type === "build-graph")
|
|
1615
|
+
this.#sendToBackend({ type: "build-graph-res", id: message.id, ok: false, error });
|
|
1613
1616
|
else
|
|
1614
1617
|
return false;
|
|
1615
1618
|
return true;
|
|
@@ -1953,7 +1956,7 @@ ${this.#backendStderrTail.join(`
|
|
|
1953
1956
|
Object.assign(this.env, { AKAN_DEV_CSR_REBUILD: "1" });
|
|
1954
1957
|
this.logger.verbose(`[csr] armed dev CSR rebuilds (${message.reason})`);
|
|
1955
1958
|
}
|
|
1956
|
-
if (message.type === "build-route" || message.type === "build-csr") {
|
|
1959
|
+
if (message.type === "build-route" || message.type === "build-csr" || message.type === "build-graph") {
|
|
1957
1960
|
const outgoing = this.#builderRequests.issue(message);
|
|
1958
1961
|
if (this.#builder?.send(outgoing))
|
|
1959
1962
|
return;
|
|
@@ -2003,7 +2006,7 @@ ${uniqueCandidates.map((candidate) => ` - ${candidate}`).join(`
|
|
|
2003
2006
|
|
|
2004
2007
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
2005
2008
|
import { Logger as Logger3, toError } from "akanjs/common";
|
|
2006
|
-
var loadBuildRunner = async () => (await import("./applicationBuildRunner-
|
|
2009
|
+
var loadBuildRunner = async () => (await import("./applicationBuildRunner-xy7hnfzq.js")).ApplicationBuildRunner;
|
|
2007
2010
|
var loadPrompts = async () => await import("@inquirer/prompts");
|
|
2008
2011
|
|
|
2009
2012
|
class ApplicationRunner extends runner("application") {
|
|
@@ -2204,7 +2207,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2204
2207
|
await new (await loadBuildRunner())(app).typecheck(options);
|
|
2205
2208
|
}
|
|
2206
2209
|
async typecheckLibrary(lib, options = {}) {
|
|
2207
|
-
const { ProjectTypecheck } = await import("./projectTypecheck-
|
|
2210
|
+
const { ProjectTypecheck } = await import("./projectTypecheck-h8rgaczy.js");
|
|
2208
2211
|
const root = lib.workspace.workspaceRoot;
|
|
2209
2212
|
await new ProjectTypecheck(lib.cwdPath, root, { ...process.env, AKAN_WORKSPACE_ROOT: root }).run([
|
|
2210
2213
|
"../../server.ts",
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
SOURCE_EXTS,
|
|
7
7
|
WatchRootResolver
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-d894868w.js";
|
|
9
9
|
import {
|
|
10
10
|
loaderFor,
|
|
11
11
|
BarrelAnalyzer,
|
|
@@ -19,11 +19,11 @@ import {
|
|
|
19
19
|
CsrDevPaths,
|
|
20
20
|
PagesEntrySourceGenerator,
|
|
21
21
|
PagesBundleBuilder
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-6t7fkx73.js";
|
|
23
23
|
import {
|
|
24
24
|
AsyncDefaultExportDetector,
|
|
25
25
|
resolveSsrPageEntriesForApp
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-38by07nw.js";
|
|
27
27
|
|
|
28
28
|
// pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
|
|
29
29
|
import { readdir, readFile, stat } from "fs/promises";
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor,
|
|
4
4
|
LibExecutor
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-38by07nw.js";
|
|
6
6
|
import {
|
|
7
7
|
createAst,
|
|
8
8
|
AkanIndex
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-re2kfscb.js";
|
|
10
10
|
import {
|
|
11
11
|
camelToKebabCase
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-r0q2ka2b.js";
|
|
13
13
|
|
|
14
14
|
// pkgs/@akanjs/devkit/workflow/artifacts.ts
|
|
15
15
|
import { capitalize as capitalize2 } from "akanjs/common";
|
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-sra1a5f8.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
WorkspaceExecutor,
|
|
15
15
|
AppExecutor
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-38by07nw.js";
|
|
17
17
|
import {
|
|
18
18
|
NativeApp
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-w60zxxye.js";
|
|
20
20
|
import {
|
|
21
21
|
runner,
|
|
22
22
|
assertPromptable
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-r0q2ka2b.js";
|
|
24
24
|
import {
|
|
25
25
|
getNpmRegistryUrl,
|
|
26
26
|
getLatestPackageVersion
|
|
@@ -142,8 +142,7 @@ ${summary.join(", ")} found${output.join(`
|
|
|
142
142
|
configFileParsingDiagnostics: parsedConfig.errors,
|
|
143
143
|
host
|
|
144
144
|
});
|
|
145
|
-
const
|
|
146
|
-
const diagnostics = [...ts.getPreEmitDiagnostics(program), ...builderProgram.emit().diagnostics];
|
|
145
|
+
const diagnostics = [...TypeChecker2.#preEmitDiagnostics(builderProgram), ...builderProgram.emit().diagnostics];
|
|
147
146
|
const errors = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
|
|
148
147
|
const warnings = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Warning);
|
|
149
148
|
return {
|
|
@@ -154,6 +153,17 @@ ${summary.join(", ")} found${output.join(`
|
|
|
154
153
|
message: TypeChecker2.formatDiagnosticMessages(diagnostics)
|
|
155
154
|
};
|
|
156
155
|
}
|
|
156
|
+
static #preEmitDiagnostics(builderProgram) {
|
|
157
|
+
const { declaration, composite } = builderProgram.getCompilerOptions();
|
|
158
|
+
return ts.sortAndDeduplicateDiagnostics([
|
|
159
|
+
...builderProgram.getConfigFileParsingDiagnostics(),
|
|
160
|
+
...builderProgram.getOptionsDiagnostics(),
|
|
161
|
+
...builderProgram.getSyntacticDiagnostics(),
|
|
162
|
+
...builderProgram.getGlobalDiagnostics(),
|
|
163
|
+
...builderProgram.getSemanticDiagnostics(),
|
|
164
|
+
...declaration || composite ? builderProgram.getDeclarationDiagnostics() : []
|
|
165
|
+
]);
|
|
166
|
+
}
|
|
157
167
|
static parseConfig(configPath) {
|
|
158
168
|
const configFile = ts.readConfigFile(configPath, (fileName) => ts.sys.readFile(fileName));
|
|
159
169
|
const configDiagnostics = configFile.error ? [configFile.error] : [];
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
LibExecutor,
|
|
11
11
|
PkgExecutor,
|
|
12
12
|
ModuleExecutor
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-38by07nw.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
|
|
16
16
|
var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|