@akanjs/devkit 3.3.0-rc.7 → 3.3.0-rc.9
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 +186 -0
- package/README.ko.md +3 -2
- package/README.md +3 -3
- package/akanApp/akanApp.host.test.ts +1 -1
- package/akanConfig/akanConfig.test.ts +55 -7
- package/akanConfig/akanConfig.ts +12 -65
- package/akanConfig/dockerImage.ts +17 -0
- package/akanConfig/nativeKeys.ts +52 -0
- package/codeAgent/agent/CodeAgent.ts +36 -16
- package/codeAgent/agent/CodeAgentAllowed.ts +35 -0
- package/codeAgent/agent/CodeAgentCommandLine.ts +372 -0
- package/codeAgent/agent/CodeAgentGate.ts +23 -4
- package/codeAgent/agent/CodeAgentRpcHost.ts +1 -1
- package/codeAgent/agent/codeAgent.test.ts +62 -0
- package/codeAgent/agent/codeAgentCommandLine.test.ts +212 -0
- package/codeAgent/agent/codeAgentContract.test.ts +117 -5
- package/codeAgent/skills/akan-agent/SKILL.md +8 -1
- package/codeAgent/skills/akan-code/SKILL.md +38 -3
- package/frontendBuild/buildRouteClient.test.ts +2 -7
- package/frontendBuild/clientEntryDiscovery.ts +2 -2
- package/frontendBuild/devBarrelImports.test.ts +30 -0
- package/frontendBuild/devBarrelImports.ts +2 -2
- package/incrementalBuilder/buildBatch.proc.ts +9 -9
- package/incrementalBuilder/buildBatchProtocol.ts +1 -1
- package/incrementalBuilder/builderBoot.ts +5 -5
- package/incrementalBuilder/builderGraphPayloads.ts +4 -4
- package/incrementalBuilder/builderLanes.ts +2 -2
- package/incrementalBuilder/builderWatch.ts +8 -8
- package/incrementalBuilder/csrRegistry.ts +4 -4
- package/incrementalBuilder/incrementalBuilder.proc.ts +8 -8
- package/incrementalBuilder/ssrRegistry.ts +6 -6
- package/index.ts +1 -1
- package/integration/renderAdmissionSoak.test.ts +99 -0
- package/integration/renderAdmissionSoak.ts +609 -0
- package/mobile/nativeConfig.test.ts +79 -0
- package/mobile/nativeConfig.ts +35 -6
- package/package.json +14 -169
- package/packageExports.test.ts +38 -24
- package/transforms/barrelAnalyzer.ts +2 -2
- package/transforms/transforms.test.ts +3 -3
- package/tunnel/createTunnel.test.ts +29 -8
- package/tunnel/createTunnel.ts +18 -11
- package/util/fileEditor.ts +1 -0
- package/util/selectModel.ts +1 -0
- package/workspace/getRelatedCnsts.ts +7 -0
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
// Module paths, never a barrel: the devkit and `frontendBuild` barrels would hold tailwindcss (~40MB), ssh2, ink
|
|
3
|
-
// and the cloud stack for the whole dev session (`entryModuleGraph.test.ts` enforces it).
|
|
4
|
-
import { ApplicationBuildReporter } from "@akanjs/devkit/app/applicationBuildReporter";
|
|
5
|
-
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
6
|
-
import { AppExecutor, type PageRoot, WorkspaceExecutor } from "@akanjs/devkit/executors";
|
|
7
|
-
import type { ClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientBuildTypes";
|
|
8
|
-
import { GraphClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientEntryDiscovery";
|
|
9
|
-
import { RouteClientBuilder } from "@akanjs/devkit/frontendBuild/routeClientBuilder";
|
|
10
2
|
import { Logger } from "akanjs/common";
|
|
11
3
|
import type {
|
|
12
4
|
BaseBuildArtifact,
|
|
@@ -18,6 +10,14 @@ import type {
|
|
|
18
10
|
BuildRouteResultPayload,
|
|
19
11
|
ChangeBatch,
|
|
20
12
|
} from "akanjs/server";
|
|
13
|
+
// Module paths, never a barrel: the devkit and `frontendBuild` barrels would hold tailwindcss (~40MB), ssh2, ink
|
|
14
|
+
// and the cloud stack for the whole dev session (`entryModuleGraph.test.ts` enforces it).
|
|
15
|
+
import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
|
|
16
|
+
import type { App } from "../commandDecorators";
|
|
17
|
+
import { AppExecutor, type PageRoot, WorkspaceExecutor } from "../executors";
|
|
18
|
+
import type { ClientEntryDiscovery } from "../frontendBuild/clientBuildTypes";
|
|
19
|
+
import { GraphClientEntryDiscovery } from "../frontendBuild/clientEntryDiscovery";
|
|
20
|
+
import { RouteClientBuilder } from "../frontendBuild/routeClientBuilder";
|
|
21
21
|
import type { BatchWork, BuildBatchRequest, BuildBatchResult, OptimizedFonts } from "./buildBatchProtocol";
|
|
22
22
|
import { BuildBatchRunner } from "./buildBatchRunner";
|
|
23
23
|
import { BuilderBoot, type IncrementalBuilderOptions } from "./builderBoot";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { rm } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { ApplicationBuildReporter } from "@akanjs/devkit/app/applicationBuildReporter";
|
|
4
|
-
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
5
|
-
import type { ClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientBuildTypes";
|
|
6
|
-
import { CsrDevPatcher } from "@akanjs/devkit/frontendBuild/csrDevPatcher";
|
|
7
|
-
import { ServerGraphFile } from "@akanjs/devkit/frontendBuild/serverGraphFile";
|
|
8
|
-
import { SsrDevBundler } from "@akanjs/devkit/frontendBuild/ssrDevBundler";
|
|
9
3
|
import type { Logger } from "akanjs/common";
|
|
10
4
|
import type { HmrTrace } from "akanjs/server";
|
|
11
5
|
import { CSR_DEV_PATCHING_MARKER } from "akanjs/server/hmr/csrDevManifest";
|
|
6
|
+
import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
|
|
7
|
+
import type { App } from "../commandDecorators";
|
|
8
|
+
import type { ClientEntryDiscovery } from "../frontendBuild/clientBuildTypes";
|
|
9
|
+
import { CsrDevPatcher } from "../frontendBuild/csrDevPatcher";
|
|
10
|
+
import { ServerGraphFile } from "../frontendBuild/serverGraphFile";
|
|
11
|
+
import { SsrDevBundler } from "../frontendBuild/ssrDevBundler";
|
|
12
12
|
import type { BatchWork, BuildBatchResult } from "./buildBatchProtocol";
|
|
13
13
|
import { isCompileError, sendBuildStatus } from "./builderBuildStatus";
|
|
14
14
|
import { BuilderChannel } from "./builderChannel";
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// XXX: types only. A value import from this barrel loads every facet (ink, typescript, ssh2, …) into the process;
|
|
2
|
-
// `export type *` erases at runtime. Import values from the owning facet (`@akanjs/devkit/
|
|
2
|
+
// `export type *` erases at runtime. Import values from the owning facet (`@akanjs/devkit/frontendBuild`) and never
|
|
3
3
|
// "fix" a TS1362 by widening an entry back to `export *`.
|
|
4
4
|
export type * from "./akanApp";
|
|
5
5
|
export type * from "./akanConfig";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from "bun:test";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { RenderAdmissionSoak } from "./renderAdmissionSoak";
|
|
6
|
+
|
|
7
|
+
const roots: string[] = [];
|
|
8
|
+
|
|
9
|
+
const workspace = () => {
|
|
10
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "akan-soak-"));
|
|
11
|
+
roots.push(root);
|
|
12
|
+
fs.mkdirSync(path.join(root, "apps", "shop", "page"), { recursive: true });
|
|
13
|
+
return { root, pageDir: RenderAdmissionSoak.pageDirOf(root, "shop") };
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const until = async (check: () => boolean, what: string) => {
|
|
17
|
+
const deadline = Date.now() + 20_000;
|
|
18
|
+
while (!check()) {
|
|
19
|
+
if (Date.now() > deadline) throw new Error(`timed out waiting for ${what}`);
|
|
20
|
+
await Bun.sleep(20);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
for (const root of roots.splice(0)) fs.rmSync(root, { recursive: true, force: true });
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe("RenderAdmissionSoak page", () => {
|
|
29
|
+
test("refuses a `page/soak` the app already has, and leaves it as it was", () => {
|
|
30
|
+
const { pageDir } = workspace();
|
|
31
|
+
fs.mkdirSync(pageDir);
|
|
32
|
+
fs.writeFileSync(path.join(pageDir, "_index.tsx"), "export default null;");
|
|
33
|
+
|
|
34
|
+
expect(() => RenderAdmissionSoak.injectPage(pageDir)).toThrow("this script did not create it");
|
|
35
|
+
expect(fs.readdirSync(pageDir)).toEqual(["_index.tsx"]);
|
|
36
|
+
RenderAdmissionSoak.removePage(pageDir);
|
|
37
|
+
expect(fs.readdirSync(pageDir)).toEqual(["_index.tsx"]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("removes only what it wrote, and the directory only when nothing else is left in it", () => {
|
|
41
|
+
const { pageDir } = workspace();
|
|
42
|
+
RenderAdmissionSoak.injectPage(pageDir);
|
|
43
|
+
expect(fs.readdirSync(pageDir).sort()).toEqual([".render-admission-soak.json", "io.tsx"]);
|
|
44
|
+
fs.writeFileSync(path.join(pageDir, "notes.tsx"), "export default null;");
|
|
45
|
+
|
|
46
|
+
RenderAdmissionSoak.removePage(pageDir);
|
|
47
|
+
expect(fs.readdirSync(pageDir)).toEqual(["notes.tsx"]);
|
|
48
|
+
|
|
49
|
+
const fresh = workspace().pageDir;
|
|
50
|
+
RenderAdmissionSoak.injectPage(fresh);
|
|
51
|
+
RenderAdmissionSoak.removePage(fresh);
|
|
52
|
+
expect(fs.existsSync(fresh)).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("takes over the page an earlier run of its own left behind", () => {
|
|
56
|
+
const { pageDir } = workspace();
|
|
57
|
+
RenderAdmissionSoak.injectPage(pageDir);
|
|
58
|
+
fs.writeFileSync(path.join(pageDir, "io.tsx"), "stale");
|
|
59
|
+
|
|
60
|
+
RenderAdmissionSoak.injectPage(pageDir);
|
|
61
|
+
expect(fs.readFileSync(path.join(pageDir, "io.tsx"), "utf8")).toContain("akanjs/client");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("a soak stopped while it builds removes its page and stops the build", async () => {
|
|
65
|
+
const { root, pageDir } = workspace();
|
|
66
|
+
const cli = path.join(root, "cli.ts");
|
|
67
|
+
const started = path.join(root, "build.pid");
|
|
68
|
+
fs.writeFileSync(
|
|
69
|
+
cli,
|
|
70
|
+
`await Bun.write(${JSON.stringify(started)}, String(process.pid));\nawait Bun.sleep(60_000);\n`,
|
|
71
|
+
);
|
|
72
|
+
const soak = Bun.spawn(
|
|
73
|
+
[
|
|
74
|
+
"bun",
|
|
75
|
+
path.join(import.meta.dir, "renderAdmissionSoak.ts"),
|
|
76
|
+
"shop",
|
|
77
|
+
"--prepare",
|
|
78
|
+
`--root=${root}`,
|
|
79
|
+
`--cli=${cli}`,
|
|
80
|
+
],
|
|
81
|
+
{ stdout: "ignore", stderr: "ignore" },
|
|
82
|
+
);
|
|
83
|
+
await until(() => fs.existsSync(started), "the build to start");
|
|
84
|
+
expect(fs.existsSync(path.join(pageDir, "io.tsx"))).toBe(true);
|
|
85
|
+
const buildPid = Number(fs.readFileSync(started, "utf8"));
|
|
86
|
+
|
|
87
|
+
soak.kill("SIGTERM");
|
|
88
|
+
expect(await soak.exited).toBe(130);
|
|
89
|
+
expect(fs.existsSync(pageDir)).toBe(false);
|
|
90
|
+
await until(() => {
|
|
91
|
+
try {
|
|
92
|
+
process.kill(buildPid, 0);
|
|
93
|
+
return false;
|
|
94
|
+
} catch {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}, "the build to stop");
|
|
98
|
+
}, 30_000);
|
|
99
|
+
});
|