@akanjs/devkit 3.2.0-rc.25 → 3.2.0-rc.26
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 +11 -0
- package/package.json +3 -3
- package/subspace/subspace.test.ts +16 -1
- package/transforms/barrelAnalyzer.ts +5 -2
- package/transforms/transforms.test.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -238,6 +238,14 @@
|
|
|
238
238
|
A generated `errorCodes` guideline lists every code a framework error carries, with its status, whether it is forwarded, and whether the caller's JSON carries it; the `akan-err` skill ships it as a reference.
|
|
239
239
|
|
|
240
240
|
- d12f556: The barrel-import rewrite maps a name that a barrel re-exports by name from another barrel (`export { migration } from "./migration"`) to the file that declares it, as it already did through `export *`. It used to stop at the inner barrel, so a page that imported one name loaded every module behind it.
|
|
241
|
+
- f3fc71a: `akan start` no longer logs `[BarrelAnalyzer] ERROR scan failed: Parse error` over and over. The message came from each app's and lib's generated `lib/useClient.ts`.
|
|
242
|
+
|
|
243
|
+
- The barrel analyzer now reads a module that calls a `with { type: "macro" }` import. Bun's `Transpiler.scan` used to throw on such a module, so the analyzer skipped it.
|
|
244
|
+
- Imports rewritten from the generated `client` barrels were already correct, so the output stays the same.
|
|
245
|
+
- A file that still fails to scan is now named in the log line.
|
|
246
|
+
|
|
247
|
+
No upgrade step is needed.
|
|
248
|
+
|
|
241
249
|
- a480576: A file moved since the fork point keeps its `akan.baseline.json` entries, whether it was moved with `git mv` or a plain rename. The growth check reads the committed entries under the path git pairs the file with, and `--fix` rewrites the working entries there, so moving a recorded file no longer fails as new debt. A move that also rewrote more than half the file, or left a file at the old path, still reads as new, since git no longer sees it as a move.
|
|
242
250
|
- 1b04784: The dev build batch worker now waits for the runner to take its result before exiting, so a result can't be lost however fast the worker finishes. In the tests, workers that exited within milliseconds of starting could lose everything they sent and be reported as crashed.
|
|
243
251
|
- 7311978: The dev builder now uses a build batch's result once the worker has sent it, and ends a worker that is still running half a second later. Before, if the release never reached the worker, as may happen with Bun on Windows, each batch waited up to 5 s for the worker to exit before its result was used.
|
|
@@ -616,6 +624,7 @@
|
|
|
616
624
|
- Updated dependencies [485f707]
|
|
617
625
|
- Updated dependencies [882e976]
|
|
618
626
|
- Updated dependencies [bb40785]
|
|
627
|
+
- Updated dependencies [11c7ac2]
|
|
619
628
|
- Updated dependencies [d2bd9b7]
|
|
620
629
|
- Updated dependencies [b391491]
|
|
621
630
|
- Updated dependencies [2d357d6]
|
|
@@ -683,6 +692,7 @@
|
|
|
683
692
|
- Updated dependencies [5d3cb3e]
|
|
684
693
|
- Updated dependencies [ad4571f]
|
|
685
694
|
- Updated dependencies [5757156]
|
|
695
|
+
- Updated dependencies [fd125b0]
|
|
686
696
|
- Updated dependencies [9a2a8c9]
|
|
687
697
|
- Updated dependencies [9a9e1fa]
|
|
688
698
|
- Updated dependencies [ce90ad0]
|
|
@@ -728,6 +738,7 @@
|
|
|
728
738
|
- Updated dependencies [c2af76a]
|
|
729
739
|
- Updated dependencies [df32c46]
|
|
730
740
|
- Updated dependencies [5f809e8]
|
|
741
|
+
- Updated dependencies [fd125b0]
|
|
731
742
|
- Updated dependencies [a5c476a]
|
|
732
743
|
- Updated dependencies [76705dd]
|
|
733
744
|
- Updated dependencies [206bb69]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "3.2.0-rc.
|
|
3
|
+
"version": "3.2.0-rc.26",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"./*": "./*.ts"
|
|
206
206
|
},
|
|
207
207
|
"dependencies": {
|
|
208
|
-
"@akanjs/language": "3.2.0-rc.
|
|
208
|
+
"@akanjs/language": "3.2.0-rc.26",
|
|
209
209
|
"@earendil-works/pi-agent-core": "1.3.0",
|
|
210
210
|
"@earendil-works/pi-ai": "1.3.0",
|
|
211
211
|
"@earendil-works/pi-codemode": "1.3.0",
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
"@earendil-works/pi-tui": "1.3.0",
|
|
215
215
|
"@inquirer/prompts": "^8.7.3",
|
|
216
216
|
"@tailwindcss/node": "^4.3.3",
|
|
217
|
-
"akanjs": "3.2.0-rc.
|
|
217
|
+
"akanjs": "3.2.0-rc.26",
|
|
218
218
|
"chalk": "^6.0.1",
|
|
219
219
|
"commander": "^15.0.0",
|
|
220
220
|
"dayjs": "^1.11.23",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, setDefaultTimeout, test } from "bun:test";
|
|
1
|
+
import { describe, expect, setDefaultTimeout, spyOn, test } from "bun:test";
|
|
2
2
|
import { mkdir, readdir, rm } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { Executor, WorkspaceExecutor } from "../executors";
|
|
@@ -214,6 +214,21 @@ describe("Subspace push", () => {
|
|
|
214
214
|
expect(await FileSys.fileExists(path.join(subspaceRoot, "libs/moved-kit/common/renamed.ts"))).toBe(true);
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
+
test("puts `--` before every repo and remote it hands git, so none reads as an option", async () => {
|
|
218
|
+
const { bareRoot, clonePath, subspace } = await makeMirror("dash-served", "dash-private", "dash-kit");
|
|
219
|
+
const spawn = spyOn(Executor.prototype, "spawn");
|
|
220
|
+
try {
|
|
221
|
+
expect((await subspace.push("develop", { verify: false })).outcome).toBe("pushed");
|
|
222
|
+
const gitArgs = spawn.mock.calls.filter(([command]) => command === "git").map(([, args]) => args);
|
|
223
|
+
expect(gitArgs).toContainEqual(["fetch", "--quiet", "--", "subspace-acme", "develop"]);
|
|
224
|
+
expect(gitArgs).toContainEqual(["clone", "--quiet", "--", bareRoot, clonePath]);
|
|
225
|
+
expect(gitArgs).toContainEqual(["fetch", "--quiet", "--", "origin", "develop"]);
|
|
226
|
+
expect(gitArgs).toContainEqual(["push", "--quiet", "--", "origin", "develop"]);
|
|
227
|
+
} finally {
|
|
228
|
+
spawn.mockRestore();
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
217
232
|
test("is idempotent — a second push with no workspace change is skipped", async () => {
|
|
218
233
|
const { subspace } = await makeMirror("idem-served", "idem-private", "idem-kit");
|
|
219
234
|
expect((await subspace.push("develop", { verify: false })).outcome).toBe("pushed");
|
|
@@ -36,6 +36,9 @@ const REEXPORT_RE =
|
|
|
36
36
|
// cannot also match `export type { X } from "./y"`.
|
|
37
37
|
const LOCAL_NAMED_RE = /(?:^|\n)\s*export\s+\{\s*([^}]*?)\s*\}(?!\s*from)/g;
|
|
38
38
|
|
|
39
|
+
// `Transpiler.scan` has no file path to resolve a macro import from, so a module calling one fails as "Parse error".
|
|
40
|
+
const MACRO_ATTR_RE = /\swith\s*\{\s*type\s*:\s*["']macro["']\s*\}/g;
|
|
41
|
+
|
|
39
42
|
const CANDIDATE_EXTS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
40
43
|
|
|
41
44
|
interface BarrelWalk {
|
|
@@ -197,10 +200,10 @@ export class BarrelAnalyzer {
|
|
|
197
200
|
#scanExports(source: string, absFile: string): Set<string> {
|
|
198
201
|
try {
|
|
199
202
|
const transpiler = [".tsx", ".jsx"].includes(path.extname(absFile)) ? this.#tsxTranspiler : this.#tsTranspiler;
|
|
200
|
-
const { exports } = transpiler.scan(source);
|
|
203
|
+
const { exports } = transpiler.scan(source.replaceAll(MACRO_ATTR_RE, ""));
|
|
201
204
|
return new Set(exports);
|
|
202
205
|
} catch (err) {
|
|
203
|
-
this.#logger.error(`scan failed: ${(err as Error).message}`);
|
|
206
|
+
this.#logger.error(`scan failed for ${absFile}: ${(err as Error).message}`);
|
|
204
207
|
return new Set();
|
|
205
208
|
}
|
|
206
209
|
}
|
|
@@ -236,6 +236,29 @@ describe("BarrelAnalyzer and rewriteBarrelImports", () => {
|
|
|
236
236
|
).toEqual(["cycleA.ts", "cycleB.ts", "index.ts", "sub/a.ts", "sub/b.ts", "sub/index.ts"]);
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
+
test("a module that calls a macro import is still read, so a name it re-exports maps past it", async () => {
|
|
240
|
+
const root = await makeTempRoot();
|
|
241
|
+
const pkgDir = path.join(root, "app");
|
|
242
|
+
await write(path.join(pkgDir, "client.ts"), 'export { usePage, sig } from "./lib/useClient";\n');
|
|
243
|
+
await write(
|
|
244
|
+
path.join(pkgDir, "lib", "useClient.ts"),
|
|
245
|
+
[
|
|
246
|
+
'import { getSerializedSignal } from "./sig" with { type: "macro" };',
|
|
247
|
+
'export { sig } from "./sigs";',
|
|
248
|
+
"export const usePage = getSerializedSignal();",
|
|
249
|
+
"",
|
|
250
|
+
].join("\n"),
|
|
251
|
+
);
|
|
252
|
+
await write(path.join(pkgDir, "lib", "sigs.ts"), "export const sig = 1;\n");
|
|
253
|
+
const analyzer = new BarrelAnalyzer({
|
|
254
|
+
resolvePackage: async () => ({ pkgName: "@apps/app", entryFile: path.join(pkgDir, "client.ts"), pkgDir }),
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
const map = await analyzer.analyze("@apps/app");
|
|
258
|
+
expect(map?.get("sig")).toEqual({ subpath: "@apps/app/lib/sigs", originalName: "sig" });
|
|
259
|
+
expect(map?.get("usePage")).toEqual({ subpath: "@apps/app/lib/useClient", originalName: "usePage" });
|
|
260
|
+
});
|
|
261
|
+
|
|
239
262
|
test("two analyses that interleave each keep their own place in their barrel", async () => {
|
|
240
263
|
const root = await makeTempRoot();
|
|
241
264
|
const barrels = { first: ["a1", "a2", "a3"], second: ["b1", "b2"] } as const;
|