@akanjs/devkit 3.3.0-rc.24 → 3.3.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 +294 -0
- package/akanApp/akanApp.host.ts +11 -0
- package/akanConfig/akanBin.ts +4 -0
- package/akanConfig/akanConfig.test.ts +11 -0
- package/akanConfig/akanConfig.ts +39 -137
- package/akanConfig/akanWorkers.test.ts +39 -0
- package/akanConfig/akanWorkers.ts +32 -0
- package/akanConfig/desktopServerConfig.ts +96 -0
- package/akanConfig/dockerImage.ts +20 -0
- package/akanConfig/types.ts +1 -0
- package/app/appBin.test.ts +63 -0
- package/app/appBin.ts +50 -0
- package/app/applicationBuildReporter.test.ts +32 -0
- package/app/applicationBuildReporter.ts +4 -0
- package/app/applicationBuildRunner.test.ts +3 -0
- package/app/applicationBuildRunner.ts +40 -4
- package/app/dictionarySizes.ts +94 -0
- package/artifact/implicitRootLayout.test.ts +19 -0
- package/artifact/implicitRootLayout.ts +16 -2
- package/artifact/storeBootstrap.test.ts +28 -0
- package/artifact/storeBootstrap.ts +60 -8
- package/biome.base.json +5 -1
- package/codeAgent/skills/akan-agent/SKILL.md +2 -2
- package/codeAgent/skills/akan-deps/SKILL.md +3 -2
- package/codeAgent/skills/akan-err/SKILL.md +2 -6
- package/codeAgent/skills/akan-mcp/SKILL.md +1 -1
- package/codeAgent/skills/akan-module/SKILL.md +2 -2
- package/codeAgent/skills/akan-query/SKILL.md +13 -20
- package/codeAgent/skills/akan-service/SKILL.md +2 -5
- package/codeAgent/skills/akan-transport/SKILL.md +5 -14
- package/codeAgent/skills/akan-ui/SKILL.md +2 -5
- package/context/akanContext.ts +2 -0
- package/executors/clientRuntimeKeyOrder.fixture.json +682 -0
- package/executors/clientRuntimeKeys.fixture.json +393 -0
- package/executors/clientRuntimeKeys.test.ts +1591 -0
- package/executors/executors.test.ts +2 -0
- package/executors/sysExecutor.ts +66 -3
- package/frontendBuild/allRoutesBuilder.ts +72 -3
- package/frontendBuild/autoImportSync.ts +3 -2
- package/frontendBuild/buildRouteClient.test.ts +513 -5
- package/frontendBuild/clientBuildTypes.ts +15 -0
- package/frontendBuild/clientEntriesBundler.ts +38 -0
- package/frontendBuild/clientEntryDiscovery.test.ts +60 -1
- package/frontendBuild/clientEntryDiscovery.ts +72 -4
- package/frontendBuild/csrDevModuleCompiler.test.ts +86 -0
- package/frontendBuild/csrDevModuleCompiler.ts +44 -8
- package/frontendBuild/csrDevPatcher.ts +33 -7
- package/frontendBuild/csrDevTypes.ts +9 -0
- package/frontendBuild/devBarrelImports.test.ts +70 -0
- package/frontendBuild/devBarrelImports.ts +80 -21
- package/frontendBuild/devRegistryBundler.ts +4 -2
- package/frontendBuild/devRouteRuntime.test.ts +492 -0
- package/frontendBuild/devRouteRuntime.ts +167 -0
- package/frontendBuild/dictionaryAssetBuilder.test.ts +316 -0
- package/frontendBuild/dictionaryAssetBuilder.ts +152 -16
- package/frontendBuild/dictionaryConstants.ts +82 -0
- package/frontendBuild/dictionaryPacking.test.ts +84 -0
- package/frontendBuild/dictionaryPacking.ts +92 -0
- package/frontendBuild/dictionaryRoutes.test.ts +186 -0
- package/frontendBuild/dictionaryRoutes.ts +225 -0
- package/frontendBuild/pagesBundleBuilder.test.ts +84 -0
- package/frontendBuild/pagesBundleBuilder.ts +78 -2
- package/frontendBuild/precompressArtifacts.ts +7 -0
- package/frontendBuild/registryMetadataFingerprint.ts +3 -3
- package/frontendBuild/routeClientBuilder.ts +288 -15
- package/frontendBuild/routeHandoffs.test.ts +119 -0
- package/frontendBuild/routeHandoffs.ts +94 -0
- package/frontendBuild/routeRuntimeCheck.test.ts +257 -0
- package/frontendBuild/routeRuntimeCheck.ts +241 -0
- package/frontendBuild/routeRuntimePays.test.ts +137 -0
- package/frontendBuild/routeRuntimePays.ts +117 -0
- package/frontendBuild/ssrBaseArtifactBuilder.ts +24 -34
- package/frontendBuild/ssrDevBundler.test.ts +150 -1
- package/frontendBuild/ssrDevBundler.ts +66 -11
- package/frontendBuild/vendorFileImports.test.ts +254 -0
- package/frontendBuild/vendorFileImports.ts +163 -0
- package/frontendBuild/vendorNarrowing.ts +28 -0
- package/frontendBuild/vendorSpecifiers.ts +2 -0
- package/incrementalBuilder/incrementalBuilder.proc.test.ts +79 -0
- package/incrementalBuilder/incrementalBuilder.proc.ts +20 -1
- package/mobile/desktopBin.ts +2 -2
- package/mobile/desktopServerStage.ts +1 -0
- package/package.json +4 -3
- package/quality/dictionaryKeys.test.ts +173 -0
- package/quality/dictionaryKeys.ts +415 -0
- package/quality/objectImportReport.test.ts +36 -0
- package/quality/objectImportReport.ts +102 -0
- package/quality/qualityScanner.ts +1 -1
- package/quality/routeRuntimeReport.test.ts +91 -0
- package/quality/routeRuntimeReport.ts +121 -0
- package/quality/runtimeConstantFacts.ts +71 -0
- package/quality/runtimeConstantGraph.ts +123 -0
- package/quality/runtimeConstantReads.ts +116 -0
- package/quality/runtimeImports.test.ts +190 -0
- package/quality/runtimeImports.ts +233 -0
- package/quality/runtimeKeyNames.ts +46 -0
- package/quality/runtimeLexicalScope.ts +132 -0
- package/quality/runtimeMarkerReach.test.ts +84 -0
- package/quality/runtimeMarkerReach.ts +255 -0
- package/quality/runtimeModuleFacts.ts +290 -0
- package/quality/runtimeNameTable.test.ts +172 -0
- package/quality/runtimeNameTable.ts +477 -0
- package/quality/runtimeScopeReport.test.ts +123 -0
- package/quality/runtimeScopeReport.ts +167 -0
- package/quality/runtimeSliceKey.ts +269 -0
- package/quality/runtimeSyntax.ts +133 -0
- package/quality/runtimeTable.fixture.ts +189 -0
- package/quality/runtimeUse.test.ts +737 -0
- package/quality/runtimeUse.ts +696 -0
- package/quality/runtimeUseReadable.test.ts +393 -0
- package/quality/ssrScanner.test.ts +13 -0
- package/quality/ssrScanner.ts +1 -1
- package/test/testHelpers.ts +11 -0
- package/transforms/barrelAnalyzer.ts +17 -1
- package/transforms/barrelImportsPlugin.ts +81 -13
- package/transforms/frameworkObjects.fixture.tsx +58 -0
- package/transforms/frameworkObjects.test.ts +54 -0
- package/transforms/modelReference.test.ts +196 -0
- package/transforms/modelReference.ts +39 -0
- package/transforms/objectImportEdits.ts +150 -0
- package/transforms/objectMemberImports.test.ts +347 -0
- package/transforms/objectMemberImports.ts +537 -0
- package/transforms/objectModule.test.ts +237 -0
- package/transforms/objectModule.ts +458 -0
- package/transforms/objectModuleAnalyzer.ts +104 -0
- package/transforms/reactIconImports.test.ts +231 -0
- package/transforms/reactIconImports.ts +325 -0
- package/transforms/routeConstants.ts +122 -0
- package/transforms/routeRuntime.test.ts +835 -0
- package/transforms/routeRuntime.ts +703 -0
- package/transforms/routeRuntimeEdits.ts +92 -0
- package/transforms/routeRuntimeGraph.ts +66 -0
- package/transforms/routeRuntimePlan.ts +244 -0
- package/transforms/signalDescriptors.test.ts +280 -0
- package/transforms/signalDescriptors.ts +227 -0
- package/transforms/thisFreeExports.ts +87 -0
- package/transforms/transforms.test.ts +139 -0
- package/workflow/executor.ts +6 -2
- package/workflow/index.ts +1 -0
- package/workflow/plan.ts +36 -7
- package/workflow/types.ts +1 -1
- package/workflow/uiTarget.ts +50 -0
- package/workspace/scanInfo.ts +1 -1
- package/workspace/workspaceLayout.ts +1 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { DictionaryPacking } from "./dictionaryPacking";
|
|
3
|
+
|
|
4
|
+
const seeded = (seed: number) => () => {
|
|
5
|
+
seed = (seed * 1103515245 + 12345) % 2147483648;
|
|
6
|
+
return seed / 2147483648;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const manyModules = () => {
|
|
10
|
+
const random = seeded(7);
|
|
11
|
+
const groups = Array.from({ length: 80 }, (_, idx) => `module${idx}`);
|
|
12
|
+
const routes = new Map<string, string[]>();
|
|
13
|
+
for (let idx = 0; idx < 300; idx++) {
|
|
14
|
+
const shown = groups.filter(() => random() < 0.12);
|
|
15
|
+
routes.set(`/:lang/route${idx}`, ["base", ...shown]);
|
|
16
|
+
}
|
|
17
|
+
routes.set("/:lang/everything", ["base", ...groups]);
|
|
18
|
+
const sizes = new Map(["base", ...groups].map((group) => [group, 200 + Math.floor(random() * 6000)]));
|
|
19
|
+
return { groups: ["base", ...groups, "unshown"], routes, bytesOf: (group: string) => sizes.get(group) ?? 100 };
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const filesOf = (routeId: string, { partsByRoute }: ReturnType<typeof DictionaryPacking.pack>) =>
|
|
23
|
+
partsByRoute[routeId] ?? [];
|
|
24
|
+
|
|
25
|
+
describe("DictionaryPacking", () => {
|
|
26
|
+
test("loads every route's groups in at most four files, over a workspace of many modules", () => {
|
|
27
|
+
const { groups, routes, bytesOf } = manyModules();
|
|
28
|
+
const pack = DictionaryPacking.pack(routes, bytesOf, groups);
|
|
29
|
+
|
|
30
|
+
for (const [routeId, shown] of routes) {
|
|
31
|
+
const files = filesOf(routeId, pack);
|
|
32
|
+
expect(files.length).toBeLessThanOrEqual(DictionaryPacking.bound);
|
|
33
|
+
const held = new Set(files.flatMap((idx) => pack.parts[idx] ?? []));
|
|
34
|
+
for (const group of shown) expect(held.has(group)).toBe(true);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("puts each group in one file, and a group no route shows in the last, which no route loads", () => {
|
|
39
|
+
const { groups, routes, bytesOf } = manyModules();
|
|
40
|
+
const pack = DictionaryPacking.pack(routes, bytesOf, groups);
|
|
41
|
+
|
|
42
|
+
expect(pack.parts.flat().sort()).toEqual([...groups].sort());
|
|
43
|
+
expect(pack.parts.at(-1)).toEqual(["unshown"]);
|
|
44
|
+
const last = pack.parts.length - 1;
|
|
45
|
+
for (const files of Object.values(pack.partsByRoute)) expect(files).not.toContain(last);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("keeps apart groups that routes take apart when merging them would cost more than a request", () => {
|
|
49
|
+
const routes = new Map([
|
|
50
|
+
["/:lang/a", ["base", "big"]],
|
|
51
|
+
["/:lang/b", ["base", "other"]],
|
|
52
|
+
]);
|
|
53
|
+
const bytesOf = (group: string) => (group === "base" ? 9000 : 8000);
|
|
54
|
+
const pack = DictionaryPacking.pack(routes, bytesOf, ["base", "big", "other"]);
|
|
55
|
+
|
|
56
|
+
expect(pack.parts).toEqual([["base"], ["big"], ["other"]]);
|
|
57
|
+
expect(pack.partsByRoute).toEqual({ "/:lang/a": [0, 1], "/:lang/b": [0, 2] });
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("merges small files every route takes together, as a request costs more than their bytes", () => {
|
|
61
|
+
const routes = new Map([
|
|
62
|
+
["/:lang/a", ["base", "tiny"]],
|
|
63
|
+
["/:lang/b", ["base", "tiny", "small"]],
|
|
64
|
+
]);
|
|
65
|
+
const bytesOf = (group: string) => (group === "base" ? 9000 : 40);
|
|
66
|
+
const pack = DictionaryPacking.pack(routes, bytesOf, ["base", "small", "tiny"]);
|
|
67
|
+
|
|
68
|
+
expect(pack.parts).toEqual([["base", "small", "tiny"]]);
|
|
69
|
+
expect(pack.partsByRoute).toEqual({ "/:lang/a": [0], "/:lang/b": [0] });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("a second route reuses the files the first one loaded where they share groups", () => {
|
|
73
|
+
const routes = new Map([
|
|
74
|
+
["/:lang/memo", ["base", "memo", "user"]],
|
|
75
|
+
["/:lang/memo/:memoId", ["base", "memo", "user", "comment"]],
|
|
76
|
+
]);
|
|
77
|
+
const bytesOf = () => 5000;
|
|
78
|
+
const pack = DictionaryPacking.pack(routes, bytesOf, ["base", "comment", "memo", "user"]);
|
|
79
|
+
const first = filesOf("/:lang/memo", pack);
|
|
80
|
+
const second = filesOf("/:lang/memo/:memoId", pack);
|
|
81
|
+
|
|
82
|
+
expect(second.filter((idx) => !first.includes(idx)).flatMap((idx) => pack.parts[idx] ?? [])).toEqual(["comment"]);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export interface DictionaryPack {
|
|
2
|
+
//? Each file's groups. A group no route names sits in the last file, which only a translation miss asks for.
|
|
3
|
+
parts: string[][];
|
|
4
|
+
partsByRoute: Record<string, number[]>;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//* Packs a page dictionary's groups into files so that a route loads at most `bound` of them. It starts from the
|
|
8
|
+
//* groups every route takes or leaves together (no route downloads a text it does not show), merges two files while
|
|
9
|
+
//* the requests it saves routes needing both outweigh the bytes it adds to routes needing one, then, inside the route
|
|
10
|
+
//* needing the most files, merges the two whose merge adds the fewest bytes until every route is within the bound.
|
|
11
|
+
export class DictionaryPacking {
|
|
12
|
+
static readonly bound = 4;
|
|
13
|
+
//? What one more request costs a route in bytes of text: headers, a round trip's share, and the brotli window a
|
|
14
|
+
//? small file compresses without.
|
|
15
|
+
static readonly requestBytes = 1024;
|
|
16
|
+
|
|
17
|
+
static pack(
|
|
18
|
+
routes: ReadonlyMap<string, readonly string[]>,
|
|
19
|
+
bytesOf: (group: string) => number,
|
|
20
|
+
groups: readonly string[],
|
|
21
|
+
{ bound = DictionaryPacking.bound, requestBytes = DictionaryPacking.requestBytes } = {},
|
|
22
|
+
): DictionaryPack {
|
|
23
|
+
const known = new Set(groups);
|
|
24
|
+
const routeIds = [...routes.keys()].sort();
|
|
25
|
+
const needs = routeIds.map((routeId) => [...new Set(routes.get(routeId))].filter((group) => known.has(group)));
|
|
26
|
+
const bySignature = new Map<string, string[]>();
|
|
27
|
+
for (const group of [...known].sort()) {
|
|
28
|
+
const signature = needs.flatMap((need, idx) => (need.includes(group) ? [idx] : [])).join(",");
|
|
29
|
+
if (signature) bySignature.set(signature, [...(bySignature.get(signature) ?? []), group]);
|
|
30
|
+
}
|
|
31
|
+
const parts = [...bySignature.values()];
|
|
32
|
+
while (DictionaryPacking.#mergeCheapest(parts, needs, bytesOf, requestBytes, null));
|
|
33
|
+
for (let worst = DictionaryPacking.#widest(parts, needs, bound); worst; ) {
|
|
34
|
+
if (!DictionaryPacking.#mergeCheapest(parts, needs, bytesOf, 0, worst)) break;
|
|
35
|
+
worst = DictionaryPacking.#widest(parts, needs, bound);
|
|
36
|
+
}
|
|
37
|
+
parts.sort((a, b) => ((a[0] ?? "") < (b[0] ?? "") ? -1 : 1));
|
|
38
|
+
const used = new Set(parts.flat());
|
|
39
|
+
const rest = [...known].filter((group) => !used.has(group)).sort((a, b) => (a < b ? -1 : 1));
|
|
40
|
+
if (rest.length) parts.push(rest);
|
|
41
|
+
const partOf = new Map(parts.flatMap((part, idx) => part.map((group) => [group, idx] as const)));
|
|
42
|
+
const partsByRoute = Object.fromEntries(
|
|
43
|
+
routeIds.map((routeId, idx) => [
|
|
44
|
+
routeId,
|
|
45
|
+
[...new Set((needs[idx] ?? []).map((group) => partOf.get(group) as number))].sort((a, b) => a - b),
|
|
46
|
+
]),
|
|
47
|
+
);
|
|
48
|
+
return { parts, partsByRoute };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static #setsOf(parts: string[][], needs: string[][]) {
|
|
52
|
+
const partOf = new Map(parts.flatMap((part, idx) => part.map((group) => [group, idx] as const)));
|
|
53
|
+
return needs.map((need) => new Set(need.map((group) => partOf.get(group) as number)));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static #widest(parts: string[][], needs: string[][], bound: number): Set<number> | null {
|
|
57
|
+
let worst: Set<number> | null = null;
|
|
58
|
+
for (const set of DictionaryPacking.#setsOf(parts, needs))
|
|
59
|
+
if (set.size > Math.max(1, bound) && (!worst || set.size > worst.size)) worst = set;
|
|
60
|
+
return worst;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//? `within` set: any pair of its files merges, the cheapest first; otherwise only a pair whose merge pays for itself.
|
|
64
|
+
static #mergeCheapest(
|
|
65
|
+
parts: string[][],
|
|
66
|
+
needs: string[][],
|
|
67
|
+
bytesOf: (group: string) => number,
|
|
68
|
+
requestBytes: number,
|
|
69
|
+
within: Set<number> | null,
|
|
70
|
+
): boolean {
|
|
71
|
+
const sets = DictionaryPacking.#setsOf(parts, needs);
|
|
72
|
+
const bytes = parts.map((part) => part.reduce((sum, group) => sum + bytesOf(group), 0));
|
|
73
|
+
const candidates = within ? [...within].sort((a, b) => a - b) : parts.map((_, idx) => idx);
|
|
74
|
+
let best: { p: number; q: number; cost: number } | null = null;
|
|
75
|
+
for (let x = 0; x < candidates.length; x++)
|
|
76
|
+
for (let y = x + 1; y < candidates.length; y++) {
|
|
77
|
+
const [p, q] = [candidates[x] as number, candidates[y] as number];
|
|
78
|
+
let cost = 0;
|
|
79
|
+
for (const set of sets) {
|
|
80
|
+
const [hasP, hasQ] = [set.has(p), set.has(q)];
|
|
81
|
+
if (hasP && hasQ) cost -= requestBytes;
|
|
82
|
+
else if (hasP) cost += bytes[q] ?? 0;
|
|
83
|
+
else if (hasQ) cost += bytes[p] ?? 0;
|
|
84
|
+
}
|
|
85
|
+
if (!best || cost < best.cost) best = { p, q, cost };
|
|
86
|
+
}
|
|
87
|
+
if (!best || (!within && best.cost >= 0)) return false;
|
|
88
|
+
parts[best.p] = [...(parts[best.p] ?? []), ...(parts[best.q] ?? [])].sort();
|
|
89
|
+
parts.splice(best.q, 1);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { runtimeFixtureTables } from "../quality/runtimeTable.fixture";
|
|
4
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
5
|
+
import { RouteRuntime } from "../transforms/routeRuntime";
|
|
6
|
+
import type { ClientModuleImport } from "./clientBuildTypes";
|
|
7
|
+
import { DictionaryAssetBuilder } from "./dictionaryAssetBuilder";
|
|
8
|
+
import { DictionaryConstants } from "./dictionaryConstants";
|
|
9
|
+
import { type DictionaryPiecesOf, DictionaryRoutes } from "./dictionaryRoutes";
|
|
10
|
+
import { RouteHandoffs } from "./routeHandoffs";
|
|
11
|
+
|
|
12
|
+
const makeRoot = tempDirs("akan-devkit-dict-routes-");
|
|
13
|
+
|
|
14
|
+
const constantsOf = () => {
|
|
15
|
+
const constants = new DictionaryConstants();
|
|
16
|
+
constants.add(
|
|
17
|
+
"apps/demo/lib/memo/memo.constant.ts",
|
|
18
|
+
`export class MemoStatus extends enumOf("memoStatus", ["draft", "done"] as const) {}
|
|
19
|
+
export class MemoInput extends via((field) => ({ status: field(MemoStatus), place: field(Address), author: field(User) })) {}
|
|
20
|
+
export class Memo extends via(MemoInput, (field) => ({})) {}
|
|
21
|
+
`,
|
|
22
|
+
);
|
|
23
|
+
constants.add(
|
|
24
|
+
"apps/demo/lib/user/user.constant.ts",
|
|
25
|
+
`export class UserRole extends enumOf("userRole", ["admin", "member"] as const) {}
|
|
26
|
+
export class UserInput extends via((field) => ({ role: field(UserRole), team: field(Team) })) {}
|
|
27
|
+
export class User extends via(UserInput, (field) => ({})) {}
|
|
28
|
+
`,
|
|
29
|
+
);
|
|
30
|
+
constants.add(
|
|
31
|
+
"apps/demo/lib/team/team.constant.ts",
|
|
32
|
+
`export class Team extends via((field) => ({ name: field(String) })) {}`,
|
|
33
|
+
);
|
|
34
|
+
constants.add(
|
|
35
|
+
"apps/demo/lib/__scalar/address/address.constant.ts",
|
|
36
|
+
`export class Address extends via((field) => ({ city: field(String) })) {}`,
|
|
37
|
+
);
|
|
38
|
+
return constants;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const workspace = async (files: Record<string, string>) => {
|
|
42
|
+
const root = await makeRoot();
|
|
43
|
+
for (const [rel, text] of Object.entries(files)) await writeText(path.join(root, rel), text);
|
|
44
|
+
const abs = (rel: string) => path.join(root, rel);
|
|
45
|
+
return { root, abs };
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const reader = (root: string, imports: Record<string, string[]>, piecesOf?: DictionaryPiecesOf): DictionaryRoutes => {
|
|
49
|
+
const importsByModule = new Map<string, ClientModuleImport[]>(
|
|
50
|
+
Object.entries(imports).map(([from, to]) => [
|
|
51
|
+
path.join(root, from),
|
|
52
|
+
to.map((rel) => ({ path: path.join(root, rel), lazy: false })),
|
|
53
|
+
]),
|
|
54
|
+
);
|
|
55
|
+
return new DictionaryRoutes(root, { importsByModule, constants: constantsOf(), ...(piecesOf ? { piecesOf } : {}) });
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
describe("DictionaryRoutes", () => {
|
|
59
|
+
test("a route shows the framework's own texts even when its client modules name no key", async () => {
|
|
60
|
+
const { root, abs } = await workspace({ "apps/demo/page/Plain.tsx": `export const Plain = () => <div />;` });
|
|
61
|
+
const read = reader(root, {}).read({ entries: [abs("apps/demo/page/Plain.tsx")] });
|
|
62
|
+
|
|
63
|
+
expect(read).toEqual({ groups: ["base"], api: false, whole: null });
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("a route loading a module's client runtime shows its model, enums, scalars and the models it refers to", async () => {
|
|
67
|
+
const { root, abs } = await workspace({
|
|
68
|
+
"apps/demo/page/Memo.tsx": `export const Page = () => <>{l("memo.modelName")}</>;`,
|
|
69
|
+
});
|
|
70
|
+
const read = reader(root, { "apps/demo/page/Memo.tsx": ["apps/demo/lib/__client/memo.st.ts"] }).read({
|
|
71
|
+
entries: [abs("apps/demo/page/Memo.tsx")],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
expect(read.whole).toBeNull();
|
|
75
|
+
expect(read.groups).toEqual(["address", "base", "memo", "memoStatus", "user", "userRole"]);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("a route naming an enum's class shows that enum's texts, through the files its entry imports", async () => {
|
|
79
|
+
const { root, abs } = await workspace({
|
|
80
|
+
"apps/demo/page/Status.tsx": `export const Page = () => <Badge />;`,
|
|
81
|
+
"apps/demo/ui/Badge.tsx": `export const Badge = () => <Select options={MemoStatus.values} label={l("shared.status")} />;`,
|
|
82
|
+
});
|
|
83
|
+
const read = reader(root, { "apps/demo/page/Status.tsx": ["apps/demo/ui/Badge.tsx"] }).read({
|
|
84
|
+
entries: [abs("apps/demo/page/Status.tsx")],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect(read.groups).toEqual(expect.arrayContaining(["base", "memoStatus", "shared"]));
|
|
88
|
+
expect(read.groups).not.toContain("memo");
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("a route with a key the build cannot follow loads the whole dictionary, naming the file and line", async () => {
|
|
92
|
+
const { root, abs } = await workspace({
|
|
93
|
+
"apps/demo/page/Any.tsx": `export const Page = () => <Label name="memo" />;`,
|
|
94
|
+
"apps/demo/ui/Label.tsx": [
|
|
95
|
+
`export const Label = ({ name }: { name: string }) => {`,
|
|
96
|
+
` const { l } = usePage();`,
|
|
97
|
+
` return <>{l(name)}</>;`,
|
|
98
|
+
`};`,
|
|
99
|
+
].join("\n"),
|
|
100
|
+
});
|
|
101
|
+
const read = reader(root, { "apps/demo/page/Any.tsx": ["apps/demo/ui/Label.tsx"] }).read({
|
|
102
|
+
entries: [abs("apps/demo/page/Any.tsx")],
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
expect(read.groups).toEqual([]);
|
|
106
|
+
expect(read.whole).toEqual({
|
|
107
|
+
file: "apps/demo/ui/Label.tsx",
|
|
108
|
+
line: 3,
|
|
109
|
+
why: "name is a parameter or prop whose type names no key",
|
|
110
|
+
});
|
|
111
|
+
expect(read.whole && DictionaryRoutes.pinned(read.whole)).toBe(
|
|
112
|
+
"apps/demo/ui/Label.tsx:3 name is a parameter or prop whose type names no key",
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("a route loading every module's client runtime loads the whole dictionary, unless the build tells it which", async () => {
|
|
117
|
+
const files = {
|
|
118
|
+
"apps/demo/page/Memo.tsx": `export const Page = () => <>{st.use.memo()}</>;`,
|
|
119
|
+
"apps/demo/lib/memo/memo.store.ts": `export class MemoStore { label = "memo.title"; }`,
|
|
120
|
+
};
|
|
121
|
+
const { root, abs } = await workspace(files);
|
|
122
|
+
const imports = { "apps/demo/page/Memo.tsx": ["apps/demo/lib/st.ts"] };
|
|
123
|
+
const entries = [abs("apps/demo/page/Memo.tsx")];
|
|
124
|
+
|
|
125
|
+
expect(reader(root, imports).read({ entries }).whole).toEqual({
|
|
126
|
+
file: "apps/demo/lib/st.ts",
|
|
127
|
+
why: "loads every module's client runtime",
|
|
128
|
+
});
|
|
129
|
+
const piecesOf: DictionaryPiecesOf = () => ({ perModule: true, pieces: ["apps/demo/lib/__client/memo.st"] });
|
|
130
|
+
const read = reader(root, imports, piecesOf).read({ entries });
|
|
131
|
+
expect(read.whole).toBeNull();
|
|
132
|
+
expect(read.groups).toEqual(["address", "base", "memo", "memoStatus", "user", "userRole"]);
|
|
133
|
+
const everyModule: DictionaryPiecesOf = () => ({ perModule: false, pieces: [] });
|
|
134
|
+
expect(reader(root, imports, everyModule).read({ entries }).whole?.why).toBe("needs every module's client runtime");
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("a server module handing a client component a model's name adds that group, and a framework surface showing any module loads the whole dictionary", async () => {
|
|
138
|
+
const { root, abs } = await workspace({
|
|
139
|
+
"apps/demo/page/Client.tsx": `export const Client = () => null;`,
|
|
140
|
+
"apps/demo/page/Server.tsx": `export const Page = () => <Load.View modelName="team" />;`,
|
|
141
|
+
"apps/demo/page/Explorer.tsx": `import { Signal } from "akanjs/ui";\nexport const Page = () => <Signal.Doc />;`,
|
|
142
|
+
});
|
|
143
|
+
const routes = reader(root, {});
|
|
144
|
+
const entries = [abs("apps/demo/page/Client.tsx")];
|
|
145
|
+
|
|
146
|
+
expect(routes.read({ entries, serverModules: [abs("apps/demo/page/Server.tsx")] }).groups).toEqual([
|
|
147
|
+
"base",
|
|
148
|
+
"team",
|
|
149
|
+
]);
|
|
150
|
+
expect(routes.read({ entries, serverModules: [abs("apps/demo/page/Explorer.tsx")] }).whole).toEqual({
|
|
151
|
+
file: "apps/demo/page/Explorer.tsx",
|
|
152
|
+
why: "Signal from akanjs/ui shows the texts of any module its data names",
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("a route naming an API description key says so, for the API description file", async () => {
|
|
157
|
+
const { root, abs } = await workspace({
|
|
158
|
+
"apps/demo/page/Api.tsx": `export const Page = () => <>{l("memo.signal.getMemo.desc")}</>;`,
|
|
159
|
+
});
|
|
160
|
+
const read = reader(root, {}).read({ entries: [abs("apps/demo/page/Api.tsx")] });
|
|
161
|
+
|
|
162
|
+
expect(read.api).toBe(true);
|
|
163
|
+
expect(read.groups).toEqual([DictionaryAssetBuilder.apiGroup, "base", "memo"]);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("a development route counts the model references its server modules hand over, not every one the root layout imports", async () => {
|
|
167
|
+
const { root, abs } = await workspace({
|
|
168
|
+
"apps/demo/page/Notes.tsx": `import { fetch } from "@apps/demo/client";\nexport const Page = (id: string) => fetch.viewNote(id);\n`,
|
|
169
|
+
"apps/demo/ui/Plain.tsx": `"use client";\nexport const Plain = () => null;\n`,
|
|
170
|
+
});
|
|
171
|
+
const { demo } = await runtimeFixtureTables();
|
|
172
|
+
const referenceOf = (model: string) => abs(`apps/demo/lib/__client/${model}.ref.ts`);
|
|
173
|
+
const handoffs = new RouteHandoffs(
|
|
174
|
+
root,
|
|
175
|
+
new RouteRuntime(root, demo, new Set()),
|
|
176
|
+
new Map(["memo", "note"].map((model) => [model, referenceOf(model)])),
|
|
177
|
+
);
|
|
178
|
+
const discovered = [abs("apps/demo/ui/Plain.tsx"), referenceOf("memo"), referenceOf("note")];
|
|
179
|
+
const serverModules = [abs("apps/demo/page/Notes.tsx")];
|
|
180
|
+
|
|
181
|
+
const entries = await DictionaryRoutes.handedEntries(discovered, serverModules, handoffs);
|
|
182
|
+
expect(entries).toEqual([abs("apps/demo/ui/Plain.tsx"), referenceOf("note")]);
|
|
183
|
+
expect(reader(root, {}).read({ entries }).groups).toEqual(["base", "note"]);
|
|
184
|
+
expect(await DictionaryRoutes.handedEntries(discovered, serverModules, null)).toEqual(discovered);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { StoreBootstrap } from "../artifact/storeBootstrap";
|
|
4
|
+
import type { App } from "../commandDecorators";
|
|
5
|
+
import { type DictionaryKeyRead, DictionaryKeys } from "../quality/dictionaryKeys";
|
|
6
|
+
import { ModelReference } from "../transforms/modelReference";
|
|
7
|
+
import { RouteRuntime } from "../transforms/routeRuntime";
|
|
8
|
+
import type { ClientEntryDiscovery, ClientModuleImport } from "./clientBuildTypes";
|
|
9
|
+
import { DictionaryAssetBuilder } from "./dictionaryAssetBuilder";
|
|
10
|
+
import { DictionaryConstants } from "./dictionaryConstants";
|
|
11
|
+
import { RouteHandoffs } from "./routeHandoffs";
|
|
12
|
+
|
|
13
|
+
export interface DictionaryRouteUnread {
|
|
14
|
+
file: string;
|
|
15
|
+
line?: number;
|
|
16
|
+
why: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface DictionaryRouteRead {
|
|
20
|
+
//? Every group the route's client modules can show, a superset: names no dictionary holds are dropped when packed.
|
|
21
|
+
groups: string[];
|
|
22
|
+
api: boolean;
|
|
23
|
+
//? Set when the route shows a key the build cannot follow: it loads the whole page dictionary.
|
|
24
|
+
whole: DictionaryRouteUnread | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface DictionaryRouteInput {
|
|
28
|
+
entries: readonly string[];
|
|
29
|
+
serverModules?: readonly string[];
|
|
30
|
+
references?: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//? Development's graph links the whole runtime, so a file importing it is asked which module pieces it would load.
|
|
34
|
+
export type DictionaryPiecesOf = (absPath: string, source: string) => { perModule: boolean; pieces: string[] } | null;
|
|
35
|
+
|
|
36
|
+
export interface DictionaryRoutesOptions {
|
|
37
|
+
importsByModule: ReadonlyMap<string, readonly ClientModuleImport[]>;
|
|
38
|
+
constants: DictionaryConstants;
|
|
39
|
+
piecesOf?: DictionaryPiecesOf;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const scoped = /^(?:apps|libs)\/[^/]+\//;
|
|
43
|
+
const piece = /^((?:apps|libs)\/[^/]+)\/lib\/__client\/([^/_.][^/.]*)\.(st|fetch|ref)(?:\.ts)?$/;
|
|
44
|
+
const wholeRuntime = /^(?:apps|libs)\/[^/]+\/lib\/(?:st|useClient)\.ts$/;
|
|
45
|
+
const noTexts = /\.(?:constant|dictionary|document|service|signal)\.ts$/;
|
|
46
|
+
const generated = /^(?:apps|libs)\/[^/]+\/(?:lib\/[^/]+\.ts$|client\.ts$|server\.ts$|\.akan\/)/;
|
|
47
|
+
//? Every page shows the framework's own texts: buttons, empty states, confirmations, validation messages.
|
|
48
|
+
const frameworkGroups = ["base"];
|
|
49
|
+
|
|
50
|
+
export class DictionaryRoutes {
|
|
51
|
+
readonly #workspaceRoot: string;
|
|
52
|
+
readonly #options: DictionaryRoutesOptions;
|
|
53
|
+
readonly #reads = new Map<string, { source: string; read: DictionaryKeyRead }>();
|
|
54
|
+
|
|
55
|
+
constructor(workspaceRoot: string, options: DictionaryRoutesOptions) {
|
|
56
|
+
this.#workspaceRoot = workspaceRoot;
|
|
57
|
+
this.#options = options;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static get frameworkGroups(): readonly string[] {
|
|
61
|
+
return frameworkGroups;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static async forApp(
|
|
65
|
+
workspaceRoot: string,
|
|
66
|
+
appScope: string,
|
|
67
|
+
options: Omit<DictionaryRoutesOptions, "constants">,
|
|
68
|
+
runtime?: RouteRuntime | null,
|
|
69
|
+
): Promise<DictionaryRoutes> {
|
|
70
|
+
const table = runtime === undefined ? await RouteRuntime.read(workspaceRoot, appScope).catch(() => null) : runtime;
|
|
71
|
+
const scopes = table?.table.layers.map(({ scope }) => scope) ?? [appScope];
|
|
72
|
+
const constants = await DictionaryConstants.read(workspaceRoot, [...new Set([appScope, ...scopes])]);
|
|
73
|
+
return new DictionaryRoutes(workspaceRoot, { ...options, constants });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//? Development reads a route as it builds, from the SSR bundle standing in for the browser's, whose graph links the
|
|
77
|
+
//? whole runtime; the constants are read again each time, as saving one restarts no builder.
|
|
78
|
+
static async ofBuiltRoute(
|
|
79
|
+
app: App,
|
|
80
|
+
route: {
|
|
81
|
+
seeds: string[];
|
|
82
|
+
entries: readonly string[];
|
|
83
|
+
importsByModule: ReadonlyMap<string, readonly ClientModuleImport[]>;
|
|
84
|
+
discovery: ClientEntryDiscovery;
|
|
85
|
+
},
|
|
86
|
+
): Promise<string[] | null> {
|
|
87
|
+
const { workspaceRoot } = app.workspace;
|
|
88
|
+
const unbuilt = route.entries.find((entry) => !route.importsByModule.has(path.resolve(entry)));
|
|
89
|
+
if (unbuilt) {
|
|
90
|
+
const fileName = path.relative(workspaceRoot, unbuilt).split(path.sep).join("/");
|
|
91
|
+
app.verbose(`[dictionary] the route loads the whole page dictionary: this builder has not bundled ${fileName}`);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const appScope = `apps/${app.name}`;
|
|
95
|
+
const runtime = await RouteRuntime.read(workspaceRoot, appScope).catch(() => null);
|
|
96
|
+
const piecesOf: DictionaryPiecesOf | undefined = runtime
|
|
97
|
+
? (absPath, source) => runtime.transform(source, absPath)
|
|
98
|
+
: undefined;
|
|
99
|
+
const reader = await DictionaryRoutes.forApp(
|
|
100
|
+
workspaceRoot,
|
|
101
|
+
appScope,
|
|
102
|
+
{ importsByModule: route.importsByModule, ...(piecesOf ? { piecesOf } : {}) },
|
|
103
|
+
runtime,
|
|
104
|
+
);
|
|
105
|
+
const { discovery } = route;
|
|
106
|
+
const serverModules =
|
|
107
|
+
"serverModules" in discovery && typeof discovery.serverModules === "function"
|
|
108
|
+
? await (discovery.serverModules as (seeds: string[]) => Promise<string[]>)(route.seeds)
|
|
109
|
+
: [];
|
|
110
|
+
const handoffs = await DictionaryRoutes.#handoffsOf(app, runtime);
|
|
111
|
+
const entries = await DictionaryRoutes.handedEntries(route.entries, serverModules, handoffs);
|
|
112
|
+
const read = reader.read({ entries, serverModules });
|
|
113
|
+
if (read.whole)
|
|
114
|
+
app.verbose(`[dictionary] the route loads the whole page dictionary: ${DictionaryRoutes.pinned(read.whole)}`);
|
|
115
|
+
return read.whole ? null : read.groups;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//? Development's root layout imports every model's reference; production keeps those a server module hands over.
|
|
119
|
+
static async handedEntries(
|
|
120
|
+
entries: readonly string[],
|
|
121
|
+
serverModules: string[],
|
|
122
|
+
handoffs: RouteHandoffs | null,
|
|
123
|
+
): Promise<readonly string[]> {
|
|
124
|
+
if (!handoffs) return entries;
|
|
125
|
+
const { referenceFiles } = await handoffs.read(serverModules);
|
|
126
|
+
return [...new Set([...entries.filter((entry) => !ModelReference.isFile(entry)), ...referenceFiles])];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static async #handoffsOf(app: App, runtime: RouteRuntime | null): Promise<RouteHandoffs | null> {
|
|
130
|
+
if (!runtime || (await StoreBootstrap.scopeOf(app)) !== "page") return null;
|
|
131
|
+
const { workspaceRoot } = app.workspace;
|
|
132
|
+
return new RouteHandoffs(workspaceRoot, runtime, await ModelReference.filesOf(workspaceRoot, `apps/${app.name}`));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static pinned({ file, line, why }: DictionaryRouteUnread): string {
|
|
136
|
+
return `${file}${line ? `:${line}` : ""} ${why}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
read({ entries, serverModules = [], references = [] }: DictionaryRouteInput): DictionaryRouteRead {
|
|
140
|
+
const names = new Set<string>(frameworkGroups);
|
|
141
|
+
const modules = new Set<string>(references);
|
|
142
|
+
const route = { names, modules, api: false as boolean, whole: null as DictionaryRouteUnread | null };
|
|
143
|
+
const queue = entries.map((entry) => path.resolve(entry));
|
|
144
|
+
const visited = new Set<string>();
|
|
145
|
+
for (let file = queue.pop(); file !== undefined && !route.whole; file = queue.pop()) {
|
|
146
|
+
if (visited.has(file)) continue;
|
|
147
|
+
visited.add(file);
|
|
148
|
+
const fileName = this.#fileNameOf(file);
|
|
149
|
+
const pieceOf = fileName.match(piece);
|
|
150
|
+
if (pieceOf?.[2]) modules.add(pieceOf[2]);
|
|
151
|
+
if (wholeRuntime.test(fileName)) {
|
|
152
|
+
if (!this.#options.piecesOf) route.whole = { file: fileName, why: "loads every module's client runtime" };
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (noTexts.test(fileName)) continue;
|
|
156
|
+
if (scoped.test(fileName) && !pieceOf && !generated.test(fileName))
|
|
157
|
+
this.#readClient(file, fileName, route, queue);
|
|
158
|
+
for (const imported of this.#options.importsByModule.get(file) ?? []) queue.push(imported.path);
|
|
159
|
+
}
|
|
160
|
+
for (const file of serverModules) {
|
|
161
|
+
if (route.whole) break;
|
|
162
|
+
const fileName = this.#fileNameOf(file);
|
|
163
|
+
if (!scoped.test(fileName) || noTexts.test(fileName) || generated.test(fileName)) continue;
|
|
164
|
+
const read = this.#readOf(file, fileName)?.read;
|
|
165
|
+
if (read?.anyModule) route.whole = { file: fileName, why: read.anyModule };
|
|
166
|
+
for (const name of read?.propNames ?? []) names.add(name);
|
|
167
|
+
}
|
|
168
|
+
if (route.whole) return { groups: [], api: route.api, whole: route.whole };
|
|
169
|
+
const { constants } = this.#options;
|
|
170
|
+
for (const module of modules) for (const group of constants.reachOf(module)) names.add(group);
|
|
171
|
+
if (route.api) names.add(DictionaryAssetBuilder.apiGroup);
|
|
172
|
+
return { groups: [...names].sort(), api: route.api, whole: null };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#readClient(
|
|
176
|
+
file: string,
|
|
177
|
+
fileName: string,
|
|
178
|
+
route: { names: Set<string>; modules: Set<string>; api: boolean; whole: DictionaryRouteUnread | null },
|
|
179
|
+
queue: string[],
|
|
180
|
+
) {
|
|
181
|
+
const known = this.#readOf(file, fileName);
|
|
182
|
+
if (!known) return;
|
|
183
|
+
const { read, source } = known;
|
|
184
|
+
const [unread] = read.unread;
|
|
185
|
+
if (unread) route.whole = { file: fileName, line: unread.line, why: unread.why };
|
|
186
|
+
else if (read.anyModule) route.whole = { file: fileName, why: read.anyModule };
|
|
187
|
+
for (const name of read.names) route.names.add(name);
|
|
188
|
+
for (const name of read.classNames)
|
|
189
|
+
for (const group of this.#options.constants.groupsOfClass(name)) route.modules.add(group);
|
|
190
|
+
route.api ||= read.api;
|
|
191
|
+
const { piecesOf } = this.#options;
|
|
192
|
+
const readsWhole = (this.#options.importsByModule.get(file) ?? []).some(({ path: imported }) =>
|
|
193
|
+
wholeRuntime.test(this.#fileNameOf(imported)),
|
|
194
|
+
);
|
|
195
|
+
if (!piecesOf || !readsWhole) return;
|
|
196
|
+
const routed = piecesOf(file, source);
|
|
197
|
+
if (routed && !routed.perModule) route.whole = { file: fileName, why: "needs every module's client runtime" };
|
|
198
|
+
for (const loaded of routed?.pieces ?? []) {
|
|
199
|
+
const [, scope, module, role] = loaded.match(piece) ?? [];
|
|
200
|
+
if (!scope || !module) continue;
|
|
201
|
+
route.modules.add(module);
|
|
202
|
+
if (role === "st")
|
|
203
|
+
for (const dir of [module, `_${module}`])
|
|
204
|
+
queue.push(path.join(this.#workspaceRoot, scope, "lib", dir, `${module}.store.ts`));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
#readOf(file: string, fileName: string) {
|
|
209
|
+
let source: string;
|
|
210
|
+
try {
|
|
211
|
+
source = readFileSync(file, "utf8");
|
|
212
|
+
} catch {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const known = this.#reads.get(file);
|
|
216
|
+
if (known?.source === source) return known;
|
|
217
|
+
const next = { source, read: DictionaryKeys.read(source, fileName) };
|
|
218
|
+
this.#reads.set(file, next);
|
|
219
|
+
return next;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
#fileNameOf(absPath: string) {
|
|
223
|
+
return path.relative(this.#workspaceRoot, absPath).split(path.sep).join("/");
|
|
224
|
+
}
|
|
225
|
+
}
|