@akanjs/devkit 3.3.0-rc.4 → 3.3.0-rc.41
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 +628 -0
- package/DEV_RUNTIME_KNOBS.md +1 -1
- package/README.ko.md +3 -2
- package/README.md +3 -3
- package/akanApp/akanApp.host.test.ts +1 -1
- package/akanApp/akanApp.host.ts +11 -0
- package/akanConfig/akanBin.ts +4 -0
- package/akanConfig/akanConfig.test.ts +66 -7
- package/akanConfig/akanConfig.ts +53 -204
- package/akanConfig/akanWorkers.test.ts +39 -0
- package/akanConfig/akanWorkers.ts +32 -0
- package/akanConfig/desktopServerConfig.ts +96 -0
- package/akanConfig/dockerImage.ts +37 -0
- package/akanConfig/nativeKeys.ts +52 -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 +275 -0
- package/app/applicationBuildRunner.ts +133 -6
- package/app/dictionarySizes.ts +91 -0
- package/app/routeFilesReport.test.ts +59 -0
- package/app/routeFilesReport.ts +46 -0
- package/app/routeJsBudget.ts +18 -4
- package/artifact/implicitRootLayout.test.ts +19 -0
- package/artifact/implicitRootLayout.ts +16 -2
- package/artifact/implicitRootLayoutRender.test.tsx +4 -1
- package/artifact/storeBootstrap.test.ts +28 -0
- package/artifact/storeBootstrap.ts +64 -8
- package/biome.base.json +6 -4
- 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/codeAgent/skills/akan-deps/SKILL.md +3 -2
- package/codeAgent/skills/akan-err/SKILL.md +13 -8
- package/codeAgent/skills/akan-mcp/SKILL.md +1 -1
- package/codeAgent/skills/akan-module/SKILL.md +2 -2
- package/codeAgent/skills/akan-page/SKILL.md +31 -20
- package/codeAgent/skills/akan-query/SKILL.md +13 -20
- package/codeAgent/skills/akan-runtime/SKILL.md +20 -0
- 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/docs/apiReference.test.ts +9 -0
- package/docs/apiReference.ts +14 -0
- package/executors/appExecutor.ts +3 -1
- package/executors/clientRuntimeKeyOrder.fixture.json +682 -0
- package/executors/clientRuntimeKeys.fixture.json +393 -0
- package/executors/clientRuntimeKeys.test.ts +1690 -0
- package/executors/executors.test.ts +2 -0
- package/executors/sysExecutor.ts +70 -4
- package/executors/workspaceExecutor.ts +7 -4
- package/frontendBuild/allRoutesBuilder.ts +88 -7
- package/frontendBuild/autoImportSync.ts +3 -2
- package/frontendBuild/buildRouteClient.test.ts +666 -12
- package/frontendBuild/clientBuildTypes.ts +26 -0
- package/frontendBuild/clientEntriesBundler.ts +49 -1
- package/frontendBuild/clientEntryDiscovery.test.ts +308 -1
- package/frontendBuild/clientEntryDiscovery.ts +135 -13
- package/frontendBuild/clientEntryGroups.test.ts +77 -0
- package/frontendBuild/clientEntryGroups.ts +61 -0
- 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 +154 -0
- package/frontendBuild/devBarrelImports.ts +83 -23
- package/frontendBuild/devRegistryBundler.ts +4 -2
- package/frontendBuild/devRouteRuntime.test.ts +492 -0
- package/frontendBuild/devRouteRuntime.ts +167 -0
- package/frontendBuild/dictionaryAssetBuilder.test.ts +324 -0
- package/frontendBuild/dictionaryAssetBuilder.ts +165 -16
- package/frontendBuild/dictionaryConstants.ts +136 -0
- package/frontendBuild/dictionaryPacking.test.ts +142 -0
- package/frontendBuild/dictionaryPacking.ts +135 -0
- package/frontendBuild/dictionaryRoutes.test.ts +251 -0
- package/frontendBuild/dictionaryRoutes.ts +227 -0
- package/frontendBuild/pagesBundleBuilder.test.ts +84 -0
- package/frontendBuild/pagesBundleBuilder.ts +81 -3
- package/frontendBuild/precompressArtifacts.test.ts +22 -0
- package/frontendBuild/precompressArtifacts.ts +22 -8
- package/frontendBuild/registryMetadataFingerprint.ts +3 -3
- package/frontendBuild/renderedEntries.ts +144 -0
- package/frontendBuild/routeClientBuilder.ts +405 -43
- package/frontendBuild/routeHandoffs.test.ts +155 -0
- package/frontendBuild/routeHandoffs.ts +117 -0
- package/frontendBuild/routeModulePreloads.test.ts +32 -0
- package/frontendBuild/routeModulePreloads.ts +20 -11
- package/frontendBuild/routeRuntimeCheck.test.ts +280 -0
- package/frontendBuild/routeRuntimeCheck.ts +248 -0
- package/frontendBuild/routeRuntimePays.test.ts +143 -0
- package/frontendBuild/routeRuntimePays.ts +117 -0
- package/frontendBuild/rscServerRendererGuard.test.ts +60 -0
- package/frontendBuild/rscServerRendererGuard.ts +68 -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/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.test.ts +79 -0
- package/incrementalBuilder/incrementalBuilder.proc.ts +27 -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/lint/__fixtures__/no-arbitrary-color/every-color-function/bad.tsx +11 -0
- package/lint/__fixtures__/no-arbitrary-color/every-color-function/good.tsx +2 -0
- package/lint/__fixtures__/no-daisyui-legacy-class/every-class/bad.tsx +34 -0
- package/lint/__fixtures__/no-daisyui-legacy-class/every-class/good.tsx +2 -0
- package/lint/__fixtures__/no-inline-color/every-color-function/bad.tsx +10 -0
- package/lint/__fixtures__/no-inline-color/every-color-function/good.tsx +2 -0
- package/lint/__fixtures__/no-raw-palette-class/every-palette/bad.tsx +22 -0
- package/lint/__fixtures__/no-raw-palette-class/every-palette/good.tsx +2 -0
- package/lint/biomeBase.test.ts +23 -3
- package/lint/biomeCheck.test.ts +145 -0
- package/lint/biomeCheck.ts +131 -0
- package/lint/no-arbitrary-color.grit +5 -0
- package/lint/no-conditional-st-hook.grit +5 -1
- package/lint/no-daisyui-legacy-class.grit +8 -0
- package/lint/no-document-cookie.grit +3 -0
- package/lint/no-inline-color.grit +10 -2
- package/lint/no-oversized-list-limit.grit +2 -0
- package/lint/no-raw-palette-class.grit +7 -0
- package/lint/no-unpublished-form-setter.grit +2 -0
- package/lint/no-web-only-api-outside-webkit.grit +5 -0
- package/lint/no-web-storage.grit +3 -0
- package/lint/withheldEnvFile.ts +17 -0
- package/mobile/desktopBin.ts +2 -2
- package/mobile/desktopServerStage.ts +1 -0
- package/mobile/nativeApp.test.ts +7 -5
- package/mobile/nativeApp.ts +2 -2
- package/mobile/nativeConfig.test.ts +96 -1
- package/mobile/nativeConfig.ts +46 -12
- package/mobile/serverBundleSecrets.ts +43 -0
- package/package.json +15 -169
- package/packageExports.test.ts +38 -24
- package/quality/dictionaryKeys.test.ts +356 -0
- package/quality/dictionaryKeys.ts +488 -0
- package/quality/objectImportReport.test.ts +36 -0
- package/quality/objectImportReport.ts +105 -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/quality/translatorBindings.ts +187 -0
- package/test/secretEnvFixture.ts +134 -0
- package/test/testHelpers.ts +11 -0
- package/transforms/barrelAnalyzer.ts +26 -4
- package/transforms/barrelImportsPlugin.ts +121 -32
- package/transforms/exportReach.test.ts +162 -0
- package/transforms/exportReach.ts +308 -0
- 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/moduleParts.test.ts +225 -0
- package/transforms/moduleParts.ts +418 -0
- package/transforms/objectImportEdits.ts +150 -0
- package/transforms/objectMemberImports.test.ts +629 -0
- package/transforms/objectMemberImports.ts +571 -0
- package/transforms/objectMemberLookup.ts +150 -0
- package/transforms/objectModule.test.ts +307 -0
- package/transforms/objectModule.ts +482 -0
- package/transforms/objectModuleAnalyzer.ts +104 -0
- package/transforms/partImports.test.ts +76 -0
- package/transforms/partImports.ts +110 -0
- package/transforms/partModules.test.ts +187 -0
- package/transforms/partModules.ts +90 -0
- package/transforms/partPurity.ts +124 -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/secretEnvDeclaration.test.ts +208 -0
- package/transforms/secretEnvDeclaration.ts +213 -0
- package/transforms/secretEnvFile.test.ts +117 -0
- package/transforms/secretEnvFile.ts +113 -0
- package/transforms/secretEnvName.test.ts +54 -0
- package/transforms/secretEnvName.ts +29 -0
- package/transforms/secretEnvSource.test.ts +148 -0
- package/transforms/secretEnvSource.ts +166 -0
- package/transforms/serverEnvEvaluationError.ts +11 -0
- package/transforms/serverEnvPlugin.test.ts +2 -1
- package/transforms/serverEnvPlugin.ts +13 -0
- package/transforms/serverEnvProfile.test.ts +115 -2
- package/transforms/serverEnvProfile.ts +117 -40
- package/transforms/serverEnvSecrets.test.ts +292 -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 +180 -3
- package/transforms/tsconfigPackageResolver.test.ts +1 -0
- package/tunnel/createTunnel.test.ts +29 -8
- package/tunnel/createTunnel.ts +18 -11
- package/typecheck/projectTypecheck.test.ts +29 -0
- package/typecheck/typeChecker.test.ts +49 -0
- package/typecheck/typeChecker.ts +9 -7
- package/typecheck/withheldDiagnostics.ts +41 -0
- package/util/fileEditor.ts +1 -0
- package/util/selectModel.ts +1 -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/getRelatedCnsts.ts +7 -0
- package/workspace/scanInfo.test.ts +39 -0
- package/workspace/scanInfo.ts +48 -5
- package/workspace/workspaceLayout.ts +1 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdir, realpath, symlink } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { printedInOwnProcess, tempDirs, writeText as write } from "../test/testHelpers";
|
|
5
|
+
import { VendorFileImports } from "./vendorFileImports";
|
|
6
|
+
import { VENDOR_SPECIFIERS } from "./vendorSpecifiers";
|
|
7
|
+
|
|
8
|
+
const makeTempRoot = tempDirs("akan-vendor-files-");
|
|
9
|
+
const akanjsRoot = path.resolve(import.meta.dir, "../../../akanjs");
|
|
10
|
+
const inAkanjs = (file: string) => path.join(akanjsRoot, file);
|
|
11
|
+
|
|
12
|
+
describe("VendorFileImports.vendorOf", () => {
|
|
13
|
+
const files = new VendorFileImports(akanjsRoot, VENDOR_SPECIFIERS);
|
|
14
|
+
|
|
15
|
+
test("a file its vendor's barrel re-exports whole comes from that vendor, by any path", () => {
|
|
16
|
+
expect(files.vendorOf("../../client/cn", inAkanjs("ui/recipe/factory.ts"))).toBe("akanjs/client");
|
|
17
|
+
expect(files.vendorOf("../client/sharedContext", inAkanjs("ui/overlayLayer.ts"))).toBe("akanjs/client");
|
|
18
|
+
expect(files.vendorOf("./device", inAkanjs("client/keyboardRide.ts"))).toBe("akanjs/client");
|
|
19
|
+
expect(files.vendorOf(inAkanjs("client/csrTypes.ts"), "/app/.akan/generated/wrapper.tsx")).toBe("akanjs/client");
|
|
20
|
+
expect(files.vendorOf("akanjs/client", inAkanjs("ui/overlayLayer.ts"))).toBe("akanjs/client");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("a file the barrel leaves out stays the importer's", () => {
|
|
24
|
+
expect(files.vendorOf("../../client/rscRoutePatch", inAkanjs("ui/System/Client.tsx"))).toBeNull();
|
|
25
|
+
expect(files.vendorOf("akanjs/client/native", inAkanjs("ui/overlayLayer.ts"))).toBeNull();
|
|
26
|
+
expect(files.vendorOf("../../store/openSeq", inAkanjs("ui/Model/LoadStore.tsx"))).toBeNull();
|
|
27
|
+
expect(files.vendorOf("../webkit/useTransitionStore", inAkanjs("server/rscClient.tsx"))).toBeNull();
|
|
28
|
+
expect(files.vendorOf("react", inAkanjs("ui/overlayLayer.ts"))).toBeNull();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("a file of another vendor stays the importer's, even one its barrel re-exports whole", () => {
|
|
32
|
+
expect(files.vendorOf("../../store/action", inAkanjs("ui/Model/LoadStore.tsx"))).toBeNull();
|
|
33
|
+
expect(files.vendorOf("akanjs/base/akanError", inAkanjs("ui/overlayLayer.ts"))).toBeNull();
|
|
34
|
+
expect(files.vendorOf("../common/akanNames", inAkanjs("client/device.ts"))).toBeNull();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("without an akanjs to read, every vendor stays external and no file maps to one", () => {
|
|
38
|
+
const unread = new VendorFileImports(null, VENDOR_SPECIFIERS);
|
|
39
|
+
expect(unread.specifiers).toEqual(VENDOR_SPECIFIERS);
|
|
40
|
+
expect(unread.vendorOf("../../client/cn", inAkanjs("ui/recipe/factory.ts"))).toBeNull();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("VendorFileImports.wholeReexports", () => {
|
|
45
|
+
test("lists only the files a barrel re-exports in full under their own names, none it shadows", async () => {
|
|
46
|
+
const root = await makeTempRoot();
|
|
47
|
+
const files: Record<string, string> = {
|
|
48
|
+
"named.ts": "export const a = 1;\nexport const b = 2;\n",
|
|
49
|
+
"starred.ts": "export const c = 1;\n",
|
|
50
|
+
"partial.ts": "export const d = 1;\nexport const e = 2;\n",
|
|
51
|
+
"renamed.ts": "export const f = 1;\n",
|
|
52
|
+
"clashA.ts": "export const g = 1;\n",
|
|
53
|
+
"clashB.ts": "export const g = 2;\n",
|
|
54
|
+
"forwarding.ts": 'export * from "./named";\n',
|
|
55
|
+
"typed.ts": "export interface T {\n t: number;\n}\n",
|
|
56
|
+
"shadowed.ts": "export const h = 1;\n",
|
|
57
|
+
"shadowedByList.ts": "export const k = 1;\n",
|
|
58
|
+
"index.ts": [
|
|
59
|
+
'export { a, b } from "./named";',
|
|
60
|
+
'export * from "./starred";',
|
|
61
|
+
'export { d } from "./partial";',
|
|
62
|
+
'export { f as renamedF } from "./renamed";',
|
|
63
|
+
'export * from "./clashA";',
|
|
64
|
+
'export * from "./clashB";',
|
|
65
|
+
'export * from "./forwarding";',
|
|
66
|
+
'export type { T } from "./typed";',
|
|
67
|
+
'export * from "./shadowed";',
|
|
68
|
+
"export const h = 2;",
|
|
69
|
+
'export * from "./shadowedByList";',
|
|
70
|
+
"const k = 2;",
|
|
71
|
+
"export { k };",
|
|
72
|
+
"",
|
|
73
|
+
].join("\n"),
|
|
74
|
+
};
|
|
75
|
+
for (const [name, source] of Object.entries(files)) await write(path.join(root, name), source);
|
|
76
|
+
|
|
77
|
+
const whole = VendorFileImports.wholeReexports(path.join(root, "index.ts")).map((file) => path.basename(file));
|
|
78
|
+
|
|
79
|
+
expect(whole.sort((a, b) => a.localeCompare(b))).toEqual(["named.ts", "starred.ts"]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe("VendorFileImports.plugin", () => {
|
|
84
|
+
test("a static import of a covered file becomes the vendor; a dynamic one stays a chunk of the build", async () => {
|
|
85
|
+
const root = await makeTempRoot();
|
|
86
|
+
const pkg = path.join(root, "akanjs");
|
|
87
|
+
await write(path.join(pkg, "client/index.ts"), 'export * from "./cn";\nexport * from "./lazy";\n');
|
|
88
|
+
await write(path.join(pkg, "client/cn.ts"), 'export const cn = () => "cn-marker";\n');
|
|
89
|
+
await write(path.join(pkg, "client/lazy.ts"), 'export const lazy = () => "lazy-marker";\n');
|
|
90
|
+
await write(
|
|
91
|
+
path.join(root, "entry.ts"),
|
|
92
|
+
'import { cn } from "./akanjs/client/cn";\nexport const run = async () => [cn(), (await import("./akanjs/client/lazy")).lazy()];\n',
|
|
93
|
+
);
|
|
94
|
+
const result = await Bun.build({
|
|
95
|
+
entrypoints: [path.join(root, "entry.ts")],
|
|
96
|
+
outdir: path.join(root, "out"),
|
|
97
|
+
splitting: true,
|
|
98
|
+
format: "esm",
|
|
99
|
+
plugins: [new VendorFileImports(pkg, ["akanjs/client"]).plugin()],
|
|
100
|
+
});
|
|
101
|
+
const code = (await Promise.all(result.outputs.map((output) => output.text()))).join("\n");
|
|
102
|
+
|
|
103
|
+
expect(code).toContain('from "akanjs/client"');
|
|
104
|
+
expect(code).not.toContain("cn-marker");
|
|
105
|
+
expect(code).toContain("lazy-marker");
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
interface BuildsReport {
|
|
110
|
+
builds: number;
|
|
111
|
+
runtimeHoldsDevice: boolean;
|
|
112
|
+
shared: string[];
|
|
113
|
+
}
|
|
114
|
+
const nativeBridge =
|
|
115
|
+
"the native bridge the barrel leaves out: the vendor's device.ts and storage.ts import it lazily, the page by path, and only the CSR shell loads either";
|
|
116
|
+
const underNativeBridge = "imported by the native bridge, so written with each of its two copies";
|
|
117
|
+
const allowedInBoth: Record<string, string> = {
|
|
118
|
+
"akanjs/client/native.ts": nativeBridge,
|
|
119
|
+
"@akanjs/native/packages/core/src/acl.ts": underNativeBridge,
|
|
120
|
+
"@akanjs/native/packages/core/src/boot.ts": underNativeBridge,
|
|
121
|
+
"@akanjs/native/packages/core/src/contract.ts": underNativeBridge,
|
|
122
|
+
"@akanjs/native/packages/core/src/errors.ts": underNativeBridge,
|
|
123
|
+
"@akanjs/native/packages/core/src/kernel.ts": underNativeBridge,
|
|
124
|
+
"@akanjs/native/packages/core/src/live.ts": underNativeBridge,
|
|
125
|
+
"@akanjs/native/packages/core/src/plugin.ts": underNativeBridge,
|
|
126
|
+
"@akanjs/native/packages/core/src/protocol.ts": underNativeBridge,
|
|
127
|
+
"@akanjs/native/packages/core/src/runtime.ts": underNativeBridge,
|
|
128
|
+
"@akanjs/native/packages/core/src/state.ts": underNativeBridge,
|
|
129
|
+
"@akanjs/native/packages/core/src/veto.ts": underNativeBridge,
|
|
130
|
+
"@akanjs/native/packages/react/src/index.ts": underNativeBridge,
|
|
131
|
+
"@akanjs/native/plugins/app-state/src/index.ts": underNativeBridge,
|
|
132
|
+
"@akanjs/native/plugins/app-state/src/web.ts": underNativeBridge,
|
|
133
|
+
"@akanjs/native/plugins/app/src/index.ts": underNativeBridge,
|
|
134
|
+
"@akanjs/native/plugins/app/src/web.ts": underNativeBridge,
|
|
135
|
+
"@akanjs/native/plugins/auth-session/src/index.ts": underNativeBridge,
|
|
136
|
+
"@akanjs/native/plugins/browser/src/args.ts": underNativeBridge,
|
|
137
|
+
"@akanjs/native/plugins/browser/src/index.ts": underNativeBridge,
|
|
138
|
+
"@akanjs/native/plugins/browser/src/web.ts": underNativeBridge,
|
|
139
|
+
"@akanjs/native/plugins/device/src/index.ts": underNativeBridge,
|
|
140
|
+
"@akanjs/native/plugins/device/src/web.ts": underNativeBridge,
|
|
141
|
+
"@akanjs/native/plugins/dialog/src/index.ts": underNativeBridge,
|
|
142
|
+
"@akanjs/native/plugins/dialog/src/options.ts": underNativeBridge,
|
|
143
|
+
"@akanjs/native/plugins/dialog/src/web.ts": underNativeBridge,
|
|
144
|
+
"@akanjs/native/plugins/file-picker/src/common.ts": underNativeBridge,
|
|
145
|
+
"@akanjs/native/plugins/file-picker/src/index.ts": underNativeBridge,
|
|
146
|
+
"@akanjs/native/plugins/file-picker/src/web.ts": underNativeBridge,
|
|
147
|
+
"@akanjs/native/plugins/haptics/src/index.ts": underNativeBridge,
|
|
148
|
+
"@akanjs/native/plugins/haptics/src/web.ts": underNativeBridge,
|
|
149
|
+
"@akanjs/native/plugins/keyboard/src/index.ts": underNativeBridge,
|
|
150
|
+
"@akanjs/native/plugins/keyboard/src/web.ts": underNativeBridge,
|
|
151
|
+
"@akanjs/native/plugins/opener/src/index.ts": underNativeBridge,
|
|
152
|
+
"@akanjs/native/plugins/opener/src/url.ts": underNativeBridge,
|
|
153
|
+
"@akanjs/native/plugins/opener/src/web.ts": underNativeBridge,
|
|
154
|
+
"@akanjs/native/plugins/preferences/src/index.ts": underNativeBridge,
|
|
155
|
+
"@akanjs/native/plugins/preferences/src/web.ts": underNativeBridge,
|
|
156
|
+
"@akanjs/native/plugins/push/src/index.ts": underNativeBridge,
|
|
157
|
+
"@akanjs/native/plugins/secure-storage/src/index.ts": underNativeBridge,
|
|
158
|
+
"@akanjs/native/plugins/updates/src/index.ts": underNativeBridge,
|
|
159
|
+
"@akanjs/native/plugins/volume/src/index.ts": underNativeBridge,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
describe("a page's two browser builds", () => {
|
|
163
|
+
test("share only the native bridge the CSR shell loads, by the barrel, a linked path, a relative one or `akanjs/client/native`", async () => {
|
|
164
|
+
const root = await realpath(await makeTempRoot());
|
|
165
|
+
const appDir = path.join(root, "apps/demo");
|
|
166
|
+
await mkdir(path.join(root, "pkgs"), { recursive: true });
|
|
167
|
+
await symlink(akanjsRoot, path.join(root, "pkgs/akanjs"), "dir");
|
|
168
|
+
const paths = { "@apps/*": ["./apps/*"], "akanjs/*": ["./pkgs/akanjs/*"] };
|
|
169
|
+
await write(path.join(root, "tsconfig.json"), JSON.stringify({ compilerOptions: { baseUrl: ".", paths } }));
|
|
170
|
+
await write(path.join(appDir, "lib/useClient.ts"), "export const usePage = () => 1;\n");
|
|
171
|
+
await write(path.join(appDir, "lib/st.ts"), "export const st = Object.freeze({});\n");
|
|
172
|
+
await write(
|
|
173
|
+
path.join(appDir, "ui/Barrel.tsx"),
|
|
174
|
+
'"use client";\nimport { cn, Device, sharedContext } from "akanjs/client";\nexport const Barrel = () => [cn("a"), Device.name, sharedContext];\n',
|
|
175
|
+
);
|
|
176
|
+
await write(
|
|
177
|
+
path.join(appDir, "ui/Relative.tsx"),
|
|
178
|
+
'"use client";\nimport { cn } from "../../../pkgs/akanjs/client/cn";\nexport const Relative = () => cn("b");\n',
|
|
179
|
+
);
|
|
180
|
+
await write(
|
|
181
|
+
path.join(appDir, "ui/Native.tsx"),
|
|
182
|
+
'"use client";\nimport { isNativeApp } from "akanjs/client/native";\nexport const Native = () => isNativeApp();\n',
|
|
183
|
+
);
|
|
184
|
+
const linked = path.join(root, "pkgs/akanjs");
|
|
185
|
+
const entries = [
|
|
186
|
+
path.join(appDir, "ui/Barrel.tsx"),
|
|
187
|
+
path.join(appDir, "ui/Relative.tsx"),
|
|
188
|
+
path.join(appDir, "ui/Native.tsx"),
|
|
189
|
+
path.join(linked, "client/device.ts"),
|
|
190
|
+
path.join(linked, "client/sharedContext.ts"),
|
|
191
|
+
path.join(linked, "client/csrTypes.ts"),
|
|
192
|
+
path.join(linked, "ui/UiOverride/UiOverride.tsx"),
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
const { shared, ...builds } = (await printedInOwnProcess(
|
|
196
|
+
`
|
|
197
|
+
const fs = await import("node:fs");
|
|
198
|
+
const path = await import("node:path");
|
|
199
|
+
const dir = ${JSON.stringify(import.meta.dir)};
|
|
200
|
+
const { RouteClientBuilder } = await import(path.join(dir, "routeClientBuilder.ts"));
|
|
201
|
+
const { SsrBaseArtifactBuilder } = await import(path.join(dir, "ssrBaseArtifactBuilder.ts"));
|
|
202
|
+
const { VendorImportScanner } = await import(path.join(dir, "vendorImportScanner.ts"));
|
|
203
|
+
const { NARROWABLE_VENDOR_SPECIFIERS } = await import(path.join(dir, "vendorSpecifiers.ts"));
|
|
204
|
+
const [root, entries, paths] = ${JSON.stringify([root, entries, paths])};
|
|
205
|
+
const builds = [];
|
|
206
|
+
const build = Bun.build;
|
|
207
|
+
Bun.build = async (config) => {
|
|
208
|
+
const result = await build(config);
|
|
209
|
+
if (config.target === "browser") builds.push({ entrypoints: config.entrypoints, metafile: result.metafile });
|
|
210
|
+
return result;
|
|
211
|
+
};
|
|
212
|
+
const app = {
|
|
213
|
+
name: "demo",
|
|
214
|
+
cwdPath: root + "/apps/demo",
|
|
215
|
+
dist: { cwdPath: root + "/dist/apps/demo" },
|
|
216
|
+
workspace: { workspaceRoot: root },
|
|
217
|
+
getConfig: async () => ({ barrelImports: [], optimizeImports: [] }),
|
|
218
|
+
getTsConfig: async () => ({ compilerOptions: { paths } }),
|
|
219
|
+
getPublicEnv: () => ({}),
|
|
220
|
+
logger: { warn: () => {} },
|
|
221
|
+
verbose: () => {},
|
|
222
|
+
};
|
|
223
|
+
const routes = await new RouteClientBuilder({ app, seeds: [], entries, command: "build", browser: "chunks" }).build();
|
|
224
|
+
const vendorExports = await VendorImportScanner.exportsUsedIn(
|
|
225
|
+
root + "/dist/apps/demo/.akan/artifact/client",
|
|
226
|
+
NARROWABLE_VENDOR_SPECIFIERS,
|
|
227
|
+
Object.values(routes.manifestDelta).map(({ id }) => id),
|
|
228
|
+
);
|
|
229
|
+
await new SsrBaseArtifactBuilder(app, "build", { vendorExports }).buildRuntimeClientEntries();
|
|
230
|
+
const modulesOf = ({ metafile }) => {
|
|
231
|
+
const modules = new Set();
|
|
232
|
+
for (const output of Object.values(metafile.outputs))
|
|
233
|
+
for (const [input, { bytesInOutput }] of Object.entries(output.inputs)) {
|
|
234
|
+
const file = path.resolve(root, input);
|
|
235
|
+
if (bytesInOutput > 0 && fs.existsSync(file)) modules.add(fs.realpathSync(file));
|
|
236
|
+
}
|
|
237
|
+
return modules;
|
|
238
|
+
};
|
|
239
|
+
const [routeBuild, runtimeBuild] = builds.map(modulesOf);
|
|
240
|
+
const pkgs = ${JSON.stringify(path.dirname(akanjsRoot))};
|
|
241
|
+
console.log(JSON.stringify({
|
|
242
|
+
builds: builds.length,
|
|
243
|
+
runtimeHoldsDevice: runtimeBuild.has(path.join(pkgs, "akanjs/client/device.ts")),
|
|
244
|
+
shared: [...routeBuild].filter((file) => runtimeBuild.has(file)).map((file) => path.relative(pkgs, file)).sort(),
|
|
245
|
+
}));
|
|
246
|
+
`,
|
|
247
|
+
root,
|
|
248
|
+
)) as BuildsReport;
|
|
249
|
+
|
|
250
|
+
expect(builds).toEqual({ builds: 2, runtimeHoldsDevice: true });
|
|
251
|
+
expect(shared).toContain("akanjs/client/native.ts");
|
|
252
|
+
expect(shared.filter((file) => !Object.hasOwn(allowedInBoth, file))).toEqual([]);
|
|
253
|
+
}, 120_000);
|
|
254
|
+
});
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import type { BunPlugin } from "bun";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
import { VendorNarrowing } from "./vendorNarrowing";
|
|
6
|
+
import { VENDOR_SPECIFIERS, type VendorSpecifier } from "./vendorSpecifiers";
|
|
7
|
+
|
|
8
|
+
const scriptExtensions = [".ts", ".tsx", ".js", ".jsx"];
|
|
9
|
+
//? Only the vendor a page loaded twice: a file of another vendor reached by its path stays in the build, as before.
|
|
10
|
+
const fileVendors: readonly VendorSpecifier[] = ["akanjs/client"];
|
|
11
|
+
|
|
12
|
+
//? A route build bundles a file of a vendor package reached by its path, beside the copy the vendor carries and the
|
|
13
|
+
//? state that copy holds; a file the vendor's barrel re-exports whole, under the same names, comes from the vendor.
|
|
14
|
+
export class VendorFileImports {
|
|
15
|
+
readonly specifiers: readonly VendorSpecifier[];
|
|
16
|
+
readonly #akanjsRoots: readonly string[];
|
|
17
|
+
readonly #specifierByModule: ReadonlyMap<string, VendorSpecifier>;
|
|
18
|
+
readonly #realDirs = new Map<string, string>();
|
|
19
|
+
|
|
20
|
+
static async of(workspaceRoot: string): Promise<VendorFileImports> {
|
|
21
|
+
const akanServerPath = await VendorFileImports.#akanServerPath(workspaceRoot);
|
|
22
|
+
return akanServerPath
|
|
23
|
+
? new VendorFileImports(path.dirname(akanServerPath), VendorFileImports.#shippedIn(akanServerPath))
|
|
24
|
+
: new VendorFileImports(null, VENDOR_SPECIFIERS);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static async specifiersIn(workspaceRoot: string): Promise<readonly VendorSpecifier[]> {
|
|
28
|
+
const akanServerPath = await VendorFileImports.#akanServerPath(workspaceRoot);
|
|
29
|
+
return akanServerPath ? VendorFileImports.#shippedIn(akanServerPath) : VENDOR_SPECIFIERS;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//? Only the vendors this akanjs ships an entry for: an older one has no `akanjs/client` vendor to import from.
|
|
33
|
+
static #shippedIn(akanServerPath: string): VendorSpecifier[] {
|
|
34
|
+
return VendorNarrowing.entriesIn(akanServerPath).map(({ specifier }) => specifier);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static async #akanServerPath(workspaceRoot: string): Promise<string | null> {
|
|
38
|
+
try {
|
|
39
|
+
return await VendorNarrowing.akanServerPath(workspaceRoot);
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
constructor(akanjsRoot: string | null, specifiers: readonly VendorSpecifier[]) {
|
|
46
|
+
this.specifiers = specifiers;
|
|
47
|
+
this.#akanjsRoots = akanjsRoot ? [...new Set([path.resolve(akanjsRoot), fs.realpathSync(akanjsRoot)])] : [];
|
|
48
|
+
this.#specifierByModule = akanjsRoot ? this.#mapModules(akanjsRoot) : new Map();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#mapModules(akanjsRoot: string): Map<string, VendorSpecifier> {
|
|
52
|
+
const specifierByModule = new Map<string, VendorSpecifier>();
|
|
53
|
+
const packaged = this.specifiers.filter((specifier) => fileVendors.includes(specifier));
|
|
54
|
+
for (const specifier of packaged) {
|
|
55
|
+
const barrel = VendorFileImports.#fileOf(path.join(akanjsRoot, specifier.slice("akanjs/".length)));
|
|
56
|
+
if (!barrel) continue;
|
|
57
|
+
for (const file of [barrel, ...VendorFileImports.wholeReexports(barrel)])
|
|
58
|
+
for (const root of this.#akanjsRoots)
|
|
59
|
+
for (const key of VendorFileImports.#moduleKeys(path.join(root, path.relative(akanjsRoot, file))))
|
|
60
|
+
if (!specifierByModule.has(key)) specifierByModule.set(key, specifier);
|
|
61
|
+
}
|
|
62
|
+
return specifierByModule;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
vendorOf(request: string, importer: string): VendorSpecifier | null {
|
|
66
|
+
const [akanjsRoot] = this.#akanjsRoots;
|
|
67
|
+
if (!akanjsRoot) return null;
|
|
68
|
+
const target = request.startsWith("akanjs/")
|
|
69
|
+
? path.join(akanjsRoot, request.slice("akanjs/".length))
|
|
70
|
+
: request.startsWith(".") || path.isAbsolute(request)
|
|
71
|
+
? path.resolve(path.dirname(importer), request)
|
|
72
|
+
: null;
|
|
73
|
+
if (!target) return null;
|
|
74
|
+
const extension = path.extname(target);
|
|
75
|
+
const module = scriptExtensions.includes(extension) ? target.slice(0, -extension.length) : target;
|
|
76
|
+
return this.#specifierByModule.get(module) ?? this.#specifierByModule.get(this.#realModule(module)) ?? null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//? A linked install reaches akanjs through a symlink, so an entry's path need not be the one Bun resolved.
|
|
80
|
+
#realModule(module: string): string {
|
|
81
|
+
const dir = path.dirname(module);
|
|
82
|
+
let realDir = this.#realDirs.get(dir);
|
|
83
|
+
if (realDir === undefined) {
|
|
84
|
+
realDir = fs.existsSync(dir) ? fs.realpathSync(dir) : dir;
|
|
85
|
+
this.#realDirs.set(dir, realDir);
|
|
86
|
+
}
|
|
87
|
+
return path.join(realDir, path.basename(module));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//? A dynamic import stays a lazy chunk of the route build: `import("akanjs/client")` would load the whole vendor.
|
|
91
|
+
plugin(): BunPlugin {
|
|
92
|
+
return {
|
|
93
|
+
name: "akan-vendor-file-imports",
|
|
94
|
+
setup: (build) => {
|
|
95
|
+
build.onResolve({ filter: /^(\.|\/|akanjs\/)/ }, (args) => {
|
|
96
|
+
if (args.kind !== "import-statement" || !args.importer) return undefined;
|
|
97
|
+
const specifier = this.vendorOf(args.path, args.importer);
|
|
98
|
+
return specifier && specifier !== args.path ? { path: specifier, external: true } : undefined;
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static wholeReexports(barrel: string): string[] {
|
|
105
|
+
const text = fs.readFileSync(barrel, "utf8");
|
|
106
|
+
const source = ts.createSourceFile(barrel, text, ts.ScriptTarget.Latest, false);
|
|
107
|
+
const sourceOfName = new Map<string, string | null>();
|
|
108
|
+
const starred = new Map<string, string | null>();
|
|
109
|
+
const files = new Set<string>();
|
|
110
|
+
for (const statement of source.statements) {
|
|
111
|
+
if (!ts.isExportDeclaration(statement) || statement.isTypeOnly) continue;
|
|
112
|
+
const { moduleSpecifier, exportClause } = statement;
|
|
113
|
+
if (!moduleSpecifier || !ts.isStringLiteral(moduleSpecifier)) continue;
|
|
114
|
+
const file = VendorFileImports.#fileOf(path.resolve(path.dirname(barrel), moduleSpecifier.text));
|
|
115
|
+
if (!file) continue;
|
|
116
|
+
files.add(file);
|
|
117
|
+
if (!exportClause) {
|
|
118
|
+
for (const name of VendorFileImports.#exportsOf(file) ?? [])
|
|
119
|
+
if (name !== "default") starred.set(name, starred.has(name) && starred.get(name) !== file ? null : file);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (!ts.isNamedExports(exportClause)) continue;
|
|
123
|
+
for (const element of exportClause.elements) {
|
|
124
|
+
if (element.isTypeOnly) continue;
|
|
125
|
+
const exported = element.name.text;
|
|
126
|
+
sourceOfName.set(exported, (element.propertyName ?? element.name).text === exported ? file : null);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//? A name the barrel exports itself shadows the one an `export *` brings in, so no starred file owns it.
|
|
130
|
+
for (const name of VendorFileImports.#scannedExports(barrel, text))
|
|
131
|
+
if (!sourceOfName.has(name)) sourceOfName.set(name, null);
|
|
132
|
+
const sourceOf = (name: string) => (sourceOfName.has(name) ? sourceOfName.get(name) : starred.get(name)) ?? null;
|
|
133
|
+
return [...files].filter((file) => {
|
|
134
|
+
const names = VendorFileImports.#exportsOf(file);
|
|
135
|
+
return !!names && names.length > 0 && names.every((name) => sourceOf(name) === file);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//? `null` for a file that re-exports with `export *`: its names are not all in its own source.
|
|
140
|
+
static #exportsOf(file: string): string[] | null {
|
|
141
|
+
const source = fs.readFileSync(file, "utf8");
|
|
142
|
+
if (/^\s*export\s*\*/m.test(source)) return null;
|
|
143
|
+
return VendorFileImports.#scannedExports(file, source);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static #scannedExports(file: string, source: string): string[] {
|
|
147
|
+
const loader = file.endsWith(".tsx") || file.endsWith(".jsx") ? "tsx" : "ts";
|
|
148
|
+
return new Bun.Transpiler({ loader }).scan(source).exports;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static #fileOf(base: string): string | null {
|
|
152
|
+
for (const candidate of [...scriptExtensions.map((ext) => `${base}${ext}`), path.join(base, "index.ts")])
|
|
153
|
+
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate;
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static #moduleKeys(file: string): string[] {
|
|
158
|
+
const withoutExtension = file.slice(0, -path.extname(file).length);
|
|
159
|
+
return path.basename(withoutExtension) === "index"
|
|
160
|
+
? [withoutExtension, path.dirname(withoutExtension)]
|
|
161
|
+
: [withoutExtension];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -16,6 +16,34 @@ export class VendorNarrowing {
|
|
|
16
16
|
readonly #akanjsRoot: string;
|
|
17
17
|
readonly #vendorExports: Partial<Record<VendorSpecifier, readonly string[]>>;
|
|
18
18
|
|
|
19
|
+
static async akanServerPath(workspaceRoot: string): Promise<string> {
|
|
20
|
+
const candidates: string[] = [];
|
|
21
|
+
try {
|
|
22
|
+
candidates.push(path.dirname(Bun.resolveSync("akanjs/server", workspaceRoot)));
|
|
23
|
+
} catch {
|
|
24
|
+
// Source workspaces and bundled CLI execution have different resolution roots; try explicit candidates below.
|
|
25
|
+
}
|
|
26
|
+
candidates.push(
|
|
27
|
+
path.join(workspaceRoot, "pkgs/akanjs/server"),
|
|
28
|
+
path.join(workspaceRoot, "node_modules/akanjs/server"),
|
|
29
|
+
);
|
|
30
|
+
try {
|
|
31
|
+
candidates.push(path.dirname(Bun.resolveSync("akanjs/server", path.dirname(Bun.main))));
|
|
32
|
+
} catch {
|
|
33
|
+
// Published CLI installs may hoist dependencies differently; explicit Bun.main candidates cover that.
|
|
34
|
+
}
|
|
35
|
+
candidates.push(
|
|
36
|
+
path.join(path.dirname(Bun.main), "node_modules/akanjs/server"),
|
|
37
|
+
path.join(path.dirname(Bun.main), "../../akanjs/server"),
|
|
38
|
+
path.resolve(import.meta.dir, "../../server"),
|
|
39
|
+
path.resolve(import.meta.dir, "../server"),
|
|
40
|
+
);
|
|
41
|
+
for (const candidate of candidates) {
|
|
42
|
+
if (await Bun.file(path.join(candidate, "rscClient.tsx")).exists()) return candidate;
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`[base-artifact] failed to locate akanjs/server; looked in: ${candidates.join(", ")}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
19
47
|
//? A devkit newer than the installed akanjs finds no agent vendor or deprecated re-export there, and builds that
|
|
20
48
|
//? akanjs's vendors whole, as the devkit it shipped with did.
|
|
21
49
|
static entriesIn(akanServerPath: string): VendorEntry[] {
|
|
@@ -10,6 +10,7 @@ export const VENDOR_SPECIFIERS = [
|
|
|
10
10
|
"akanjs/store",
|
|
11
11
|
"akanjs/store/agent",
|
|
12
12
|
"akanjs/base",
|
|
13
|
+
"akanjs/client",
|
|
13
14
|
"akanjs/common",
|
|
14
15
|
"akanjs/constant",
|
|
15
16
|
"akanjs/fetch",
|
|
@@ -24,6 +25,7 @@ export const NARROWABLE_VENDOR_SPECIFIERS = [
|
|
|
24
25
|
"akanjs/store",
|
|
25
26
|
"akanjs/store/agent",
|
|
26
27
|
"akanjs/base",
|
|
28
|
+
"akanjs/client",
|
|
27
29
|
"akanjs/common",
|
|
28
30
|
"akanjs/constant",
|
|
29
31
|
"akanjs/fetch",
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { Logger } from "akanjs/common";
|
|
3
|
+
import type { BuilderMessage, BuildPhase, HmrTrace } from "akanjs/server";
|
|
4
|
+
import { resolveDevCsrMode } from "akanjs/server/hmr/csrDevManifest";
|
|
5
|
+
import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
|
|
6
|
+
import { resolveSsrPageEntriesForApp } from "../artifact/implicitRootLayout";
|
|
7
|
+
import { computeRouteSeedIndex, saveRouteSeedIndex } from "../artifact/routeSeedIndex";
|
|
8
|
+
import type { App } from "../commandDecorators";
|
|
6
9
|
// Subpath imports only, as few as possible: spawned per generation, this process pays every import on every save.
|
|
7
|
-
import { AppExecutor, WorkspaceExecutor } from "
|
|
10
|
+
import { AppExecutor, WorkspaceExecutor } from "../executors";
|
|
8
11
|
import {
|
|
9
12
|
CsrArtifactBuilder,
|
|
10
13
|
CsrDevBundler,
|
|
@@ -14,10 +17,7 @@ import {
|
|
|
14
17
|
ServerGraphFile,
|
|
15
18
|
SsrBaseArtifactBuilder,
|
|
16
19
|
SsrDevBundler,
|
|
17
|
-
} from "
|
|
18
|
-
import { Logger } from "akanjs/common";
|
|
19
|
-
import type { BuilderMessage, BuildPhase, HmrTrace } from "akanjs/server";
|
|
20
|
-
import { resolveDevCsrMode } from "akanjs/server/hmr/csrDevManifest";
|
|
20
|
+
} from "../frontendBuild";
|
|
21
21
|
import type { BuildBatchRequest, BuildBatchResult, OptimizedFonts, PagesBatchCssAssets } from "./buildBatchProtocol";
|
|
22
22
|
|
|
23
23
|
// `Bun.build` keeps native bundler arenas that `Bun.gc(true)` cannot reclaim; only exiting returns them.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FontOptimizer } from "@akanjs/devkit/frontendBuild";
|
|
2
1
|
import type { BaseBuildArtifact, CssPayload, HmrTrace, PagesBundlePayload } from "akanjs/server";
|
|
2
|
+
import type { FontOptimizer } from "../frontendBuild";
|
|
3
3
|
|
|
4
4
|
export type OptimizedFonts = Awaited<ReturnType<FontOptimizer["optimize"]>>;
|
|
5
5
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
3
|
-
import type { ClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientBuildTypes";
|
|
4
|
-
import { GraphClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientEntryDiscovery";
|
|
5
|
-
import { HmrWatcher } from "@akanjs/devkit/frontendBuild/hmrWatcher";
|
|
6
|
-
import { WatchRootResolver } from "@akanjs/devkit/frontendBuild/watchRootResolver";
|
|
7
2
|
import type { Logger } from "akanjs/common";
|
|
8
3
|
import type { BaseBuildArtifact } from "akanjs/server";
|
|
4
|
+
import type { App } from "../commandDecorators";
|
|
5
|
+
import type { ClientEntryDiscovery } from "../frontendBuild/clientBuildTypes";
|
|
6
|
+
import { GraphClientEntryDiscovery } from "../frontendBuild/clientEntryDiscovery";
|
|
7
|
+
import { HmrWatcher } from "../frontendBuild/hmrWatcher";
|
|
8
|
+
import { WatchRootResolver } from "../frontendBuild/watchRootResolver";
|
|
9
9
|
import type { OptimizedFonts } from "./buildBatchProtocol";
|
|
10
10
|
import type { BuildBatchRunner } from "./buildBatchRunner";
|
|
11
11
|
import { BuilderChannel } from "./builderChannel";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
2
|
-
import { FrameworkGraph } from "@akanjs/devkit/docs/frameworkGraph";
|
|
3
|
-
import { GitRevision } from "@akanjs/devkit/workspace/gitRevision";
|
|
4
|
-
import { WorkspaceGraph } from "@akanjs/devkit/workspace/workspaceGraph";
|
|
5
1
|
import type { BuildChangesPayload, BuilderGraphReq, BuildFrameworkPayload, BuildGraphPayload } from "akanjs/server";
|
|
2
|
+
import type { App } from "../commandDecorators";
|
|
3
|
+
import { FrameworkGraph } from "../docs/frameworkGraph";
|
|
4
|
+
import { GitRevision } from "../workspace/gitRevision";
|
|
5
|
+
import { WorkspaceGraph } from "../workspace/workspaceGraph";
|
|
6
6
|
|
|
7
7
|
export class BuilderGraphPayloads {
|
|
8
8
|
readonly #app: App;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApplicationBuildReporter } from "@akanjs/devkit/app/applicationBuildReporter";
|
|
2
|
-
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
3
1
|
import type { Logger } from "akanjs/common";
|
|
2
|
+
import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
|
|
3
|
+
import type { App } from "../commandDecorators";
|
|
4
4
|
import type { BatchWork, BuildBatchResult } from "./buildBatchProtocol";
|
|
5
5
|
import { sendBuildStatus } from "./builderBuildStatus";
|
|
6
6
|
import { BuilderChannel } from "./builderChannel";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
3
|
-
import type { PageRoot } from "@akanjs/devkit/executors";
|
|
4
|
-
import { AutoImportSync } from "@akanjs/devkit/frontendBuild/autoImportSync";
|
|
5
|
-
import { DevChangePlanner } from "@akanjs/devkit/frontendBuild/devChangePlanner";
|
|
6
|
-
import { DevGeneratedIndexSync } from "@akanjs/devkit/frontendBuild/devGeneratedIndexSync";
|
|
7
|
-
import { HmrWatcher } from "@akanjs/devkit/frontendBuild/hmrWatcher";
|
|
8
|
-
import { WatchRootResolver } from "@akanjs/devkit/frontendBuild/watchRootResolver";
|
|
9
|
-
import { CodegenLock } from "@akanjs/devkit/workspace/codegenLock";
|
|
10
2
|
import type { Logger } from "akanjs/common";
|
|
11
3
|
import type { ChangeBatch } from "akanjs/server";
|
|
4
|
+
import type { App } from "../commandDecorators";
|
|
5
|
+
import type { PageRoot } from "../executors";
|
|
6
|
+
import { AutoImportSync } from "../frontendBuild/autoImportSync";
|
|
7
|
+
import { DevChangePlanner } from "../frontendBuild/devChangePlanner";
|
|
8
|
+
import { DevGeneratedIndexSync } from "../frontendBuild/devGeneratedIndexSync";
|
|
9
|
+
import { HmrWatcher } from "../frontendBuild/hmrWatcher";
|
|
10
|
+
import { WatchRootResolver } from "../frontendBuild/watchRootResolver";
|
|
11
|
+
import { CodegenLock } from "../workspace/codegenLock";
|
|
12
12
|
import type { BuildBatchNeed } from "./buildBatchProtocol";
|
|
13
13
|
import { sendBuildStatus } from "./builderBuildStatus";
|
|
14
14
|
import { BuilderChannel } from "./builderChannel";
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { CsrDevBundler } from "@akanjs/devkit/frontendBuild/csrDevBundler";
|
|
6
|
-
import { CsrDevPatcher } from "@akanjs/devkit/frontendBuild/csrDevPatcher";
|
|
7
3
|
import type { Logger } from "akanjs/common";
|
|
8
4
|
import type { BaseBuildArtifact, BuilderCsrReq, HmrTrace } from "akanjs/server";
|
|
9
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 { CsrDevBundler } from "../frontendBuild/csrDevBundler";
|
|
9
|
+
import { CsrDevPatcher } from "../frontendBuild/csrDevPatcher";
|
|
10
10
|
import type { BatchWork, BuildBatchRequest } from "./buildBatchProtocol";
|
|
11
11
|
import type { BuildBatchRunner } from "./buildBatchRunner";
|
|
12
12
|
import { isCompileError, sendBuildStatus } from "./builderBuildStatus";
|