@akanjs/cli 3.2.0-rc.1 → 3.2.0-rc.11
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 +2 -1
- package/{CodeAgent-vmd9k4ak.js → CodeAgent-fk66n37w.js} +3 -3
- package/{CodeTui-zka44v52.js → CodeTui-4rf1mqmv.js} +1 -1
- package/README.ko.md +26 -1
- package/README.md +26 -1
- package/TunnelShare-44er4e29.js +15 -0
- package/{agent.command-2f657613.js → agent.command-7g9czkkd.js} +20 -19
- package/akanCode.js +3 -3
- package/{application.command-q6skd3am.js → application.command-00spg55s.js} +31 -24
- package/{applicationBuildRunner-sctcmkyx.js → applicationBuildRunner-f4yf0qyc.js} +9 -7
- package/buildBatch.proc.js +7 -6
- package/{cloud.command-7642pks6.js → cloud.command-ab704p0g.js} +24 -25
- package/cloud.script-4p4y0s7e.js +31 -0
- package/{code.command-7s4ndq2k.js → code.command-m6c9xk56.js} +7 -6
- package/{context.command-569z0rqf.js → context.command-hgcgxtdk.js} +20 -19
- package/context.runner-w071gmc3.js +30 -0
- package/{devTui-w38ch13a.js → devTui-h77zrjv5.js} +1 -1
- package/{guideline.command-gnv3e8p8.js → guideline.command-6yz6d4hf.js} +3 -2
- package/guidelines/agentRule/agentRule.instruction.md +4 -3
- package/guidelines/akanApi/akanApi.instruction.md +2 -0
- package/guidelines/conventions/core.md +1 -1
- package/guidelines/conventions/rules/app.md +3 -0
- package/guidelines/conventions/rules/page.md +5 -0
- package/guidelines/errorCodes/errorCodes.instruction.md +140 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +72 -2
- package/guidelines/pageRule/pageRule.instruction.md +5 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +5 -1
- package/guidelines/transportRule/transportRule.instruction.md +5 -0
- package/incrementalBuilder.proc.js +8 -7
- package/{index-vkzfk7qt.js → index-097bjwvm.js} +40 -30
- package/{index-93ewzmp6.js → index-23d8gw08.js} +165 -102
- package/{index-p6hjwt2d.js → index-41mfhgq0.js} +72 -26
- package/{index-ktb3wcqz.js → index-4k9nv4m3.js} +71 -81
- package/{index-vr68mxj5.js → index-5jwx4bf2.js} +69 -33
- package/{index-5w9my9qe.js → index-6eptmk8z.js} +30 -20
- package/{index-d4n1wmrz.js → index-6fnrhpn1.js} +8 -4
- package/{index-kpdv34rq.js → index-6qtxs86x.js} +10 -7
- package/{index-ed6ea0qp.js → index-6z57w95f.js} +1 -1
- package/{index-drz9e84d.js → index-7ky4brfy.js} +2 -2
- package/{index-8g7tdsk4.js → index-849qvd7t.js} +58 -29
- package/{index-1q1cjn8s.js → index-9xh4zvw3.js} +94 -53
- package/{index-48d5qsj3.js → index-adj7qmz9.js} +23 -15
- package/{index-fjr4d6yd.js → index-apcr1qgk.js} +458 -304
- package/{index-8ts9774g.js → index-aybfcx58.js} +9 -4
- package/{index-8kczhnmv.js → index-b3pr4ee6.js} +1 -1
- package/{index-23860fej.js → index-b4qq3rq0.js} +23 -8
- package/{index-thckcabc.js → index-bper31wr.js} +24 -6
- package/{index-a8a9ede9.js → index-bxkx0x03.js} +14 -7
- package/{index-0fb3cpbt.js → index-c3r23w24.js} +9 -7
- package/{index-8pb9yvp8.js → index-dfsa009c.js} +148 -31
- package/{index-zpv14wpy.js → index-dsg50er9.js} +3 -3
- package/{index-hqrkqxx2.js → index-e5f6czck.js} +46 -7
- package/{index-sy481q2x.js → index-frvjq1rd.js} +1 -1
- package/{index-abgh0jve.js → index-grt0e6kk.js} +1 -1
- package/{index-e3vmjtph.js → index-hf9nvwam.js} +7 -2
- package/{index-v4p1zye8.js → index-hhagjhkh.js} +7 -7
- package/index-j4yvgfhr.js +70 -0
- package/{index-s2grpzef.js → index-k2r3hmbz.js} +6 -4
- package/{index-7y5yghjg.js → index-nd39rssn.js} +1162 -435
- package/{index-6wpaq392.js → index-p4htjyvk.js} +44 -5
- package/{index-aj3ehkcx.js → index-p54s83sz.js} +1 -1
- package/{index-7xdpww43.js → index-rdx8cyv2.js} +342 -134
- package/{index-sr5da35e.js → index-sq9d0jhj.js} +21 -18
- package/{index-eajbmk10.js → index-t4d0ckde.js} +2 -2
- package/{index-mqntfzv5.js → index-t8h09yjs.js} +7 -2
- package/index-va90m8nd.js +25 -0
- package/{index-rc5fvqj2.js → index-xfv2p7b5.js} +95 -58
- package/{index-w639tvkd.js → index-xgqz3kak.js} +29 -8
- package/{index-9tbgb4d8.js → index-xy70tcv4.js} +1 -1
- package/{index-mmym5xmb.js → index-z43wddce.js} +5 -3
- package/index.js +24 -23
- package/{library.command-1gp5qe3r.js → library.command-kc1zahcg.js} +5 -4
- package/{localRegistry.command-x7jptkd3.js → localRegistry.command-bz2df40m.js} +19 -18
- package/{module.command-4xz9he6h.js → module.command-cchwzz9r.js} +12 -7
- package/{package.command-s7qpnn1g.js → package.command-qcjajpv8.js} +8 -7
- package/package.json +2 -2
- package/{page.command-fan34c49.js → page.command-1t86dx8a.js} +4 -3
- package/{pipeline.command-ph4fnn9w.js → pipeline.command-2xx9z3d0.js} +3 -2
- package/{primitive.command-3fqh8emf.js → primitive.command-mc0x8txr.js} +8 -7
- package/{projectTypecheck-vkb40hjc.js → projectTypecheck-tz497yx7.js} +2 -1
- package/{quality.command-ecj6exsh.js → quality.command-11rayf5c.js} +7 -6
- package/{repair.command-fe9jw719.js → repair.command-8w41vy78.js} +7 -6
- package/{scalar.command-cnvfhk0n.js → scalar.command-rvwh98ny.js} +7 -6
- package/skills/akan-debug/SKILL.md +7 -3
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +10 -1
- package/skills/akan-scaffold/SKILL.md +3 -2
- package/skills/akan-transport/SKILL.md +2 -0
- package/skills/akan-validate/SKILL.md +1 -0
- package/{subspace.command-qw5ddd6y.js → subspace.command-0970n7kd.js} +9 -8
- package/{tunnel.command-ggj38mqf.js → tunnel.command-bcy0rtmh.js} +8 -7
- package/typecheck.proc.js +5 -2
- package/{verify.command-w9ttxkdz.js → verify.command-ynaztxr2.js} +18 -16
- package/{workflow.command-ss8devj0.js → workflow.command-yp9ajthb.js} +45 -16
- package/{workspace.command-6z2rh8ze.js → workspace.command-e4wfxm86.js} +39 -34
- package/TunnelShare-k3ja4w9x.js +0 -14
- package/cloud.script-1sfseznn.js +0 -30
- package/context.runner-ms8v1rxy.js +0 -29
|
@@ -3,12 +3,13 @@ import {
|
|
|
3
3
|
AsyncDefaultExportDetector,
|
|
4
4
|
StoreBootstrap,
|
|
5
5
|
resolveSsrPageEntriesForApp
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-sq9d0jhj.js";
|
|
7
7
|
import {
|
|
8
8
|
FileSys2
|
|
9
9
|
} from "./index-bns3wcpc.js";
|
|
10
10
|
|
|
11
11
|
// pkgs/@akanjs/devkit/transforms/barrelAnalyzer.ts
|
|
12
|
+
import fs from "fs";
|
|
12
13
|
import path from "path";
|
|
13
14
|
import { Logger } from "akanjs/common";
|
|
14
15
|
|
|
@@ -53,6 +54,8 @@ class BarrelAnalyzer {
|
|
|
53
54
|
#logger = new Logger("BarrelAnalyzer");
|
|
54
55
|
#opts;
|
|
55
56
|
#cache = new Map;
|
|
57
|
+
#read = new Map;
|
|
58
|
+
#realDirs = new Map;
|
|
56
59
|
#tsTranspiler = new Bun.Transpiler({ loader: "ts" });
|
|
57
60
|
#tsxTranspiler = new Bun.Transpiler({ loader: "tsx" });
|
|
58
61
|
constructor(opts) {
|
|
@@ -66,13 +69,40 @@ class BarrelAnalyzer {
|
|
|
66
69
|
this.#cache.set(pkgName, promise);
|
|
67
70
|
return promise;
|
|
68
71
|
}
|
|
72
|
+
async filesOf(pkgName) {
|
|
73
|
+
await this.analyze(pkgName);
|
|
74
|
+
return [...this.#read.get(pkgName) ?? []];
|
|
75
|
+
}
|
|
76
|
+
forget(files) {
|
|
77
|
+
const dirs = new Set(files.map((file) => realDirOf(file)));
|
|
78
|
+
const forgotten = new Map;
|
|
79
|
+
for (const [pkgName, read] of this.#read) {
|
|
80
|
+
const analysis = this.#cache.get(pkgName);
|
|
81
|
+
if (!analysis || ![...read].some((file) => dirs.has(this.#realDirOf(file))))
|
|
82
|
+
continue;
|
|
83
|
+
forgotten.set(pkgName, analysis);
|
|
84
|
+
this.#cache.delete(pkgName);
|
|
85
|
+
this.#read.delete(pkgName);
|
|
86
|
+
}
|
|
87
|
+
return forgotten;
|
|
88
|
+
}
|
|
89
|
+
#realDirOf(file) {
|
|
90
|
+
let dir = this.#realDirs.get(file);
|
|
91
|
+
if (dir === undefined) {
|
|
92
|
+
dir = realDirOf(file);
|
|
93
|
+
this.#realDirs.set(file, dir);
|
|
94
|
+
}
|
|
95
|
+
return dir;
|
|
96
|
+
}
|
|
69
97
|
async#analyzeSafe(pkgName) {
|
|
70
98
|
try {
|
|
71
99
|
const pkg = await this.#opts.resolvePackage(pkgName);
|
|
72
100
|
if (!pkg)
|
|
73
101
|
return null;
|
|
74
102
|
const map = new Map;
|
|
75
|
-
|
|
103
|
+
const read = new Set;
|
|
104
|
+
this.#read.set(pkgName, read);
|
|
105
|
+
await this.#walk(pkg.entryFile, pkg, map, read);
|
|
76
106
|
return map;
|
|
77
107
|
} catch (err) {
|
|
78
108
|
this.#logger.error(`analyze failed for ${pkgName}: ${err.message}`);
|
|
@@ -180,6 +210,14 @@ class BarrelAnalyzer {
|
|
|
180
210
|
return defaultResolveRelative(fromFile, relSpec);
|
|
181
211
|
}
|
|
182
212
|
}
|
|
213
|
+
var realDirOf = (file) => {
|
|
214
|
+
const dir = path.dirname(path.resolve(file));
|
|
215
|
+
try {
|
|
216
|
+
return fs.realpathSync.native(dir);
|
|
217
|
+
} catch {
|
|
218
|
+
return dir;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
183
221
|
var isRelative = (spec) => {
|
|
184
222
|
return spec.startsWith("./") || spec.startsWith("../") || spec === "." || spec === "..";
|
|
185
223
|
};
|
|
@@ -397,7 +435,8 @@ var resolveFileCandidate = async (candidate) => {
|
|
|
397
435
|
return null;
|
|
398
436
|
};
|
|
399
437
|
var MACRO_ATTR_RE = /with\s*\{\s*type\s*:\s*["']macro["']\s*\}/;
|
|
400
|
-
var
|
|
438
|
+
var workspaceBarrels = (barrels) => barrels.filter((barrel) => /^@(?:apps|libs)\//.test(barrel));
|
|
439
|
+
var rewriteBarrelImports = async (source, barrels, analyzer, { keepLines = false, specifierOf = (subpath) => subpath, onImport } = {}) => {
|
|
401
440
|
if (!barrels.some((barrel) => source.includes(barrel)))
|
|
402
441
|
return null;
|
|
403
442
|
const statements = findImportStatements(source);
|
|
@@ -411,12 +450,19 @@ var rewriteBarrelImports = async (source, barrels, analyzer) => {
|
|
|
411
450
|
continue;
|
|
412
451
|
if (!barrels.includes(stmt.specifier))
|
|
413
452
|
continue;
|
|
453
|
+
const names = valueNamesOf(stmt.clause);
|
|
454
|
+
if (names.length > 0)
|
|
455
|
+
onImport?.(stmt.specifier, names);
|
|
414
456
|
const map = await analyzer.analyze(stmt.specifier);
|
|
415
457
|
if (!map || map.size === 0)
|
|
416
458
|
continue;
|
|
417
|
-
const
|
|
418
|
-
if (
|
|
459
|
+
const lines = rewriteSingleStatement(stmt, map, specifierOf);
|
|
460
|
+
if (lines === null)
|
|
419
461
|
continue;
|
|
462
|
+
const replacement = keepLines ? `${lines.join(" ")}${`
|
|
463
|
+
`.repeat(source.slice(stmt.start, stmt.end).split(`
|
|
464
|
+
`).length - 1)}` : lines.join(`
|
|
465
|
+
`);
|
|
420
466
|
out = out.slice(0, stmt.start) + replacement + out.slice(stmt.end);
|
|
421
467
|
changed = true;
|
|
422
468
|
}
|
|
@@ -436,45 +482,40 @@ var findImportStatements = (source) => {
|
|
|
436
482
|
statements.push({
|
|
437
483
|
start: statement.getStart(sourceFile),
|
|
438
484
|
end: statement.end,
|
|
439
|
-
clause:
|
|
485
|
+
clause: clauseOf(importClause),
|
|
440
486
|
specifier: statement.moduleSpecifier.text
|
|
441
487
|
});
|
|
442
488
|
}
|
|
443
489
|
return statements;
|
|
444
490
|
};
|
|
445
|
-
var
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
const parsed = { typeOnly };
|
|
453
|
-
const commaMatch = /^(\w+)\s*,\s*(.+)$/.exec(rest);
|
|
454
|
-
if (commaMatch) {
|
|
455
|
-
parsed.defaultImport = commaMatch[1];
|
|
456
|
-
rest = commaMatch[2] ?? "";
|
|
457
|
-
} else if (/^\w+$/.test(rest)) {
|
|
458
|
-
parsed.defaultImport = rest;
|
|
491
|
+
var clauseOf = (importClause) => {
|
|
492
|
+
const parsed = { typeOnly: importClause.phaseModifier === ts.SyntaxKind.TypeKeyword };
|
|
493
|
+
if (importClause.name)
|
|
494
|
+
parsed.defaultImport = importClause.name.text;
|
|
495
|
+
const bindings = importClause.namedBindings;
|
|
496
|
+
if (!bindings)
|
|
459
497
|
return parsed;
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
498
|
+
if (ts.isNamespaceImport(bindings))
|
|
499
|
+
return { ...parsed, namespaceImport: bindings.name.text };
|
|
500
|
+
const named = [];
|
|
501
|
+
for (const element of bindings.elements) {
|
|
502
|
+
if (element.propertyName && !ts.isIdentifier(element.propertyName))
|
|
464
503
|
return null;
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if (close === -1)
|
|
471
|
-
return null;
|
|
472
|
-
parsed.named = parseNamedList(rest.slice(1, close));
|
|
504
|
+
named.push({
|
|
505
|
+
imported: (element.propertyName ?? element.name).text,
|
|
506
|
+
local: element.name.text,
|
|
507
|
+
isType: element.isTypeOnly
|
|
508
|
+
});
|
|
473
509
|
}
|
|
474
|
-
return parsed;
|
|
510
|
+
return { ...parsed, named };
|
|
511
|
+
};
|
|
512
|
+
var valueNamesOf = (clause) => {
|
|
513
|
+
if (!clause || clause.namespaceImport || clause.typeOnly)
|
|
514
|
+
return [];
|
|
515
|
+
return (clause.named ?? []).filter((item) => !item.isType).map((item) => item.imported);
|
|
475
516
|
};
|
|
476
|
-
var rewriteSingleStatement = (stmt, map) => {
|
|
477
|
-
const clause =
|
|
517
|
+
var rewriteSingleStatement = (stmt, map, specifierOf) => {
|
|
518
|
+
const { clause } = stmt;
|
|
478
519
|
if (!clause)
|
|
479
520
|
return null;
|
|
480
521
|
if (clause.namespaceImport)
|
|
@@ -497,7 +538,7 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
497
538
|
continue;
|
|
498
539
|
}
|
|
499
540
|
if (target.namespace) {
|
|
500
|
-
namespaceLines.push(`import * as ${item.local} from
|
|
541
|
+
namespaceLines.push(`import * as ${item.local} from ${JSON.stringify(specifierOf(target.subpath))};`);
|
|
501
542
|
continue;
|
|
502
543
|
}
|
|
503
544
|
const list = rewrites.get(target.subpath) ?? [];
|
|
@@ -506,7 +547,7 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
506
547
|
}
|
|
507
548
|
if (rewrites.size === 0 && namespaceLines.length === 0)
|
|
508
549
|
return null;
|
|
509
|
-
const lines =
|
|
550
|
+
const lines = (StoreBootstrap.ofClientBarrel(stmt.specifier, map) ?? []).map((specifier) => `import ${JSON.stringify(specifierOf(specifier))};`);
|
|
510
551
|
if (clause.defaultImport || remaining.length > 0) {
|
|
511
552
|
const parts = [];
|
|
512
553
|
if (clause.defaultImport)
|
|
@@ -516,11 +557,10 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
516
557
|
lines.push(`import ${parts.join(", ")} from "${stmt.specifier}";`);
|
|
517
558
|
}
|
|
518
559
|
for (const [subpath, items] of rewrites) {
|
|
519
|
-
lines.push(`import { ${items.map(serializeNamedItem).join(", ")} } from
|
|
560
|
+
lines.push(`import { ${items.map(serializeNamedItem).join(", ")} } from ${JSON.stringify(specifierOf(subpath))};`);
|
|
520
561
|
}
|
|
521
562
|
lines.push(...namespaceLines);
|
|
522
|
-
return lines
|
|
523
|
-
`);
|
|
563
|
+
return lines;
|
|
524
564
|
};
|
|
525
565
|
var serializeNamedItem = (item) => {
|
|
526
566
|
const prefix = item.isType ? "type " : "";
|
|
@@ -536,12 +576,13 @@ var bundleDefine = (app, command, renderEnv) => {
|
|
|
536
576
|
return {
|
|
537
577
|
"process.env.NODE_ENV": JSON.stringify(nodeEnv),
|
|
538
578
|
"process.env.AKAN_PUBLIC_RENDER_ENV": JSON.stringify(renderEnv),
|
|
579
|
+
"process.env.AKAN_BUNDLE_COMMAND": JSON.stringify(command),
|
|
539
580
|
...Object.fromEntries(Object.entries(app.getPublicEnv()).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)]))
|
|
540
581
|
};
|
|
541
582
|
};
|
|
542
583
|
|
|
543
584
|
// pkgs/@akanjs/devkit/frontendBuild/csrDevPaths.ts
|
|
544
|
-
import
|
|
585
|
+
import fs2 from "fs";
|
|
545
586
|
import path3 from "path";
|
|
546
587
|
|
|
547
588
|
class CsrDevPaths {
|
|
@@ -572,18 +613,18 @@ class CsrDevPaths {
|
|
|
572
613
|
return /\.[cm]?[jt]sx?$/.test(file);
|
|
573
614
|
}
|
|
574
615
|
static mtimeOf(file) {
|
|
575
|
-
return
|
|
616
|
+
return fs2.statSync(file, { throwIfNoEntry: false })?.mtimeMs ?? -1;
|
|
576
617
|
}
|
|
577
618
|
static async hashOf(file) {
|
|
578
619
|
const source = Bun.file(file);
|
|
579
620
|
return await source.exists() ? Bun.hash(await source.arrayBuffer()).toString(36) : "";
|
|
580
621
|
}
|
|
581
622
|
static realpath(file) {
|
|
582
|
-
return
|
|
623
|
+
return fs2.existsSync(file) ? fs2.realpathSync.native(file) : path3.resolve(file);
|
|
583
624
|
}
|
|
584
625
|
static isNamed(file) {
|
|
585
626
|
try {
|
|
586
|
-
return
|
|
627
|
+
return fs2.realpathSync.native(file) === file;
|
|
587
628
|
} catch {
|
|
588
629
|
return false;
|
|
589
630
|
}
|
|
@@ -601,7 +642,7 @@ class CsrDevPaths {
|
|
|
601
642
|
return folder ? CsrDevPaths.#asFolder(base, kind) : CsrDevPaths.resolveOnDisk(base, kind);
|
|
602
643
|
}
|
|
603
644
|
static #asFile(base, kind) {
|
|
604
|
-
const isFile = (candidate) =>
|
|
645
|
+
const isFile = (candidate) => fs2.statSync(candidate, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
605
646
|
return [base, ...CsrDevPaths.#extensions[kind].map((extension) => `${base}${extension}`)].find(isFile) ?? null;
|
|
606
647
|
}
|
|
607
648
|
static #asFolder(dir, kind) {
|
|
@@ -614,7 +655,7 @@ class CsrDevPaths {
|
|
|
614
655
|
}
|
|
615
656
|
static #packageEntryOf(dir, kind) {
|
|
616
657
|
try {
|
|
617
|
-
const pkg = JSON.parse(
|
|
658
|
+
const pkg = JSON.parse(fs2.readFileSync(path3.join(dir, "package.json"), "utf8"));
|
|
618
659
|
const fields = kind === "require" ? [pkg.browser, pkg.main] : [pkg.browser, pkg.module, pkg.main];
|
|
619
660
|
const entry = fields.find((field) => typeof field === "string");
|
|
620
661
|
return typeof entry === "string" ? entry : null;
|
|
@@ -629,8 +670,8 @@ class CsrDevPaths {
|
|
|
629
670
|
return false;
|
|
630
671
|
for (let dir = path3.resolve(from);; dir = path3.dirname(dir)) {
|
|
631
672
|
const pkgDir = path3.join(dir, "node_modules", name);
|
|
632
|
-
if (
|
|
633
|
-
return (
|
|
673
|
+
if (fs2.existsSync(path3.join(pkgDir, "package.json")))
|
|
674
|
+
return (fs2.statSync(pkgDir, { throwIfNoEntry: false })?.ctimeMs ?? 0) > since;
|
|
634
675
|
if (path3.dirname(dir) === dir)
|
|
635
676
|
return false;
|
|
636
677
|
}
|
|
@@ -674,7 +715,7 @@ class CsrEntryFiles {
|
|
|
674
715
|
}
|
|
675
716
|
|
|
676
717
|
// pkgs/@akanjs/devkit/frontendBuild/pagesBundleBuilder.ts
|
|
677
|
-
import
|
|
718
|
+
import fs4 from "fs";
|
|
678
719
|
import path9 from "path";
|
|
679
720
|
import ts3 from "typescript";
|
|
680
721
|
|
|
@@ -930,14 +971,14 @@ ${entries.join(`
|
|
|
930
971
|
}
|
|
931
972
|
|
|
932
973
|
// pkgs/@akanjs/devkit/frontendBuild/serverGraphFile.ts
|
|
933
|
-
import
|
|
974
|
+
import fs3 from "fs";
|
|
934
975
|
import path8 from "path";
|
|
935
976
|
class ServerGraphFile {
|
|
936
977
|
static fileName = "server-graph.json";
|
|
937
978
|
static #cache = null;
|
|
938
979
|
static async read(artifactDir) {
|
|
939
980
|
const file = path8.join(artifactDir, ServerGraphFile.fileName);
|
|
940
|
-
const stat =
|
|
981
|
+
const stat = fs3.statSync(file, { throwIfNoEntry: false });
|
|
941
982
|
if (!stat)
|
|
942
983
|
return null;
|
|
943
984
|
const stamp = `${stat.ino}:${stat.size}:${stat.mtimeMs}`;
|
|
@@ -1074,7 +1115,7 @@ class PagesBundleBuilder {
|
|
|
1074
1115
|
};
|
|
1075
1116
|
}
|
|
1076
1117
|
#serverGraph(metafile, clientExports) {
|
|
1077
|
-
const inputs = Object.keys(metafile.inputs).filter((input) => !input.includes("node_modules")).map((input) => path9.resolve(input)).filter((input) =>
|
|
1118
|
+
const inputs = Object.keys(metafile.inputs).filter((input) => !input.includes("node_modules")).map((input) => path9.resolve(input)).filter((input) => fs4.existsSync(input)).map((input) => CsrDevPaths.realpath(input));
|
|
1078
1119
|
return { inputs, clientExports };
|
|
1079
1120
|
}
|
|
1080
1121
|
get #artifactDir() {
|
|
@@ -1182,4 +1223,4 @@ class PagesBundleBuilder {
|
|
|
1182
1223
|
}
|
|
1183
1224
|
}
|
|
1184
1225
|
|
|
1185
|
-
export { loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, rewriteBarrelImports, bundleConditions, bundleDefine, CsrEntryFiles, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
|
|
1226
|
+
export { loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, workspaceBarrels, rewriteBarrelImports, bundleConditions, bundleDefine, CsrEntryFiles, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
script
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-23d8gw08.js";
|
|
5
5
|
import {
|
|
6
6
|
AppExecutor,
|
|
7
7
|
LibExecutor,
|
|
8
8
|
ModuleExecutor
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-sq9d0jhj.js";
|
|
10
10
|
import {
|
|
11
11
|
InteractionScaffold,
|
|
12
12
|
workflowStatus,
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
normalizeFieldType,
|
|
23
23
|
ensureNamedImport,
|
|
24
24
|
ensureBaseImport,
|
|
25
|
-
ensureBaseTypeImport,
|
|
26
25
|
coerceFieldDefault,
|
|
27
26
|
fieldExpression,
|
|
28
27
|
viaBuilderParameterName,
|
|
@@ -43,12 +42,16 @@ import {
|
|
|
43
42
|
hasSignalFactoryEntry,
|
|
44
43
|
insertSignalFactoryEntry,
|
|
45
44
|
addFieldUiPolicyForType,
|
|
45
|
+
withFieldTypeImport,
|
|
46
46
|
KeyRename,
|
|
47
47
|
MutationScaffold
|
|
48
|
-
} from "./index-
|
|
48
|
+
} from "./index-dfsa009c.js";
|
|
49
49
|
import {
|
|
50
50
|
ModuleScript
|
|
51
|
-
} from "./index-
|
|
51
|
+
} from "./index-aybfcx58.js";
|
|
52
|
+
import {
|
|
53
|
+
plainNameProblem
|
|
54
|
+
} from "./index-va90m8nd.js";
|
|
52
55
|
|
|
53
56
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
54
57
|
import { capitalize, lowerlize } from "akanjs/common";
|
|
@@ -65,11 +68,9 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
|
|
|
65
68
|
}
|
|
66
69
|
async createUi(workspace, input) {
|
|
67
70
|
const sys = await this.resolveSys(workspace, input.app);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
!input.module && PrimitiveScript.#inputMissing("module")
|
|
72
|
-
]));
|
|
71
|
+
const moduleProblem = PrimitiveScript.#moduleProblem(input.module);
|
|
72
|
+
if (!sys || !input.module || moduleProblem)
|
|
73
|
+
return PrimitiveScript.#refuse("create-ui", compactDiagnostics([!sys && PrimitiveScript.#targetMissing(), moduleProblem]));
|
|
73
74
|
const mod = ModuleExecutor.from(sys, input.module);
|
|
74
75
|
if (input.surface === "view")
|
|
75
76
|
return await this.moduleScript.createView(mod);
|
|
@@ -91,7 +92,7 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
|
|
|
91
92
|
const normalizedType = input.type ? normalizeFieldType(input.type) : null;
|
|
92
93
|
const diagnostics = compactDiagnostics([
|
|
93
94
|
!sys && PrimitiveScript.#targetMissing(),
|
|
94
|
-
|
|
95
|
+
PrimitiveScript.#moduleProblem(input.module),
|
|
95
96
|
!input.field && PrimitiveScript.#inputMissing("field"),
|
|
96
97
|
!input.type && PrimitiveScript.#inputMissing("type"),
|
|
97
98
|
enumValues?.length === 0 && PrimitiveScript.#inputMissing("values", "Enum values are required."),
|
|
@@ -157,7 +158,7 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
|
|
|
157
158
|
const defaultCoercion = coerceFieldDefault(input.type, input.defaultValue);
|
|
158
159
|
if (defaultCoercion.diagnostic)
|
|
159
160
|
diagnostics.push(defaultCoercion.diagnostic);
|
|
160
|
-
constantContent =
|
|
161
|
+
constantContent = await withFieldTypeImport(sys, input.module, input.type, constantContent, diagnostics);
|
|
161
162
|
if (input.type === "Date" && defaultCoercion.expression)
|
|
162
163
|
constantContent = ensureBaseImport(constantContent, "dayjs");
|
|
163
164
|
}
|
|
@@ -451,13 +452,14 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
|
|
|
451
452
|
});
|
|
452
453
|
}
|
|
453
454
|
static #report(command, sys, changedFiles, diagnostics) {
|
|
455
|
+
const failed = workflowStatus(diagnostics) === "failed";
|
|
454
456
|
return createPrimitiveWriteReport({
|
|
455
457
|
command,
|
|
456
458
|
changedFiles,
|
|
457
|
-
generatedFiles: generatedFilesForSync(sys),
|
|
458
|
-
validationCommands: validationCommandsForTarget(sys.name),
|
|
459
|
+
generatedFiles: failed ? [] : generatedFilesForSync(sys),
|
|
460
|
+
validationCommands: failed ? [] : validationCommandsForTarget(sys.name),
|
|
459
461
|
diagnostics,
|
|
460
|
-
nextActions: nextActionsForTarget(sys.name)
|
|
462
|
+
nextActions: failed ? [] : nextActionsForTarget(sys.name)
|
|
461
463
|
});
|
|
462
464
|
}
|
|
463
465
|
static #targetMissing() {
|
|
@@ -466,6 +468,12 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
|
|
|
466
468
|
static #inputMissing(input, message = `${capitalize(input)} is required.`) {
|
|
467
469
|
return { severity: "error", code: "primitive-input-missing", message, input };
|
|
468
470
|
}
|
|
471
|
+
static #moduleProblem(module) {
|
|
472
|
+
if (!module)
|
|
473
|
+
return PrimitiveScript.#inputMissing("module");
|
|
474
|
+
const message = plainNameProblem("module", module);
|
|
475
|
+
return message ? { severity: "error", code: "primitive-input-invalid", message, input: "module" } : null;
|
|
476
|
+
}
|
|
469
477
|
static #sourceMissing(kind, path) {
|
|
470
478
|
return {
|
|
471
479
|
severity: "error",
|