@akanjs/devkit 3.3.0-rc.25 → 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
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,155 @@
|
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- af57986: An app declares code that runs in a process of its own, and the framework builds, finds and supervises it.
|
|
8
|
+
|
|
9
|
+
`workers` in an app's `akan.config.ts` maps a name to an entry file (`workers: { vision: "srvkit/vision.worker.ts" }`). `akan build` bundles each as its own entry to `workers/<name>.js`, with the server's externals and env handling and never as a chunk of `server.js`, so a native addon the worker imports is not loaded by the server. The image and a desktop app's server carry the folder; `akan start` and `akan test` run the worker from its declared source.
|
|
10
|
+
|
|
11
|
+
`AppWorker.spawn(name, options)` from `akanjs/server` starts it with the Bun that runs the server: stdout and stderr are relayed line by line to the server's logger, a worker that exits with an error or on a signal is started again with a doubling delay (1s to 30s; `restart: false` leaves it down, an exit with code 0 stays down), `onMessage` opens an IPC channel that `worker.send` writes to, `stop()` sends SIGTERM and then SIGKILL, and every running worker gets SIGTERM when the server process exits. The worker gets the variables a process needs to start plus `options.env`, not the server's env, unless `inheritEnv` is set. `AppWorker.pathOf(name)` returns the file for code that spawns by hand. An undeclared name throws `AppWorkerError` with the code `workerNotDeclared`, and `send` without a channel `workerNotConnected`.
|
|
12
|
+
|
|
13
|
+
The runtime guideline documents the section, and its reference files are larger: `runtimeRule-2.md` by 3430 bytes and `akanApi-app-config.md` by 138.
|
|
14
|
+
|
|
15
|
+
No upgrade step for an app. `AppConfigResult` gains a required `workers`, so code that builds one by hand adds `workers: {}`; `akanjs/server/appWorkerPath` is a new entry point the build tooling reads.
|
|
16
|
+
|
|
17
|
+
- e3f405f: A page whose server component hands a model to a framework component (`Load.Units`, `Load.View`, `Model.New`, `Model.Edit`, `Data.CardList` and the others) now loads that model's store and descriptors, not every module of the app. Before, those components loaded the whole client runtime wherever they rendered.
|
|
18
|
+
|
|
19
|
+
- `akan sync` writes `lib/__client/<model>.ref.ts` for each model with a signal and `lib/__client/refs.ts` for the app. The generated root layout imports `refs.ts`, and the server then adds the model's client reference to every slice, init, view and edit it hands to a client component, as the optional `_runtime` field of `SliceMeta`, `ServerInit`, `ServerView` and `ServerEdit`. The browser loads the reference, and with it the model's store and descriptors, before the component receiving the object renders: on the first page, inside a streamed part of it, and after a client navigation. A model the app extends loads through the app's store, which loads the lib's first. A reference loads what a client file reading `st.use.<model>` loads: the stores the model's store names come with it, and where that store picks a name at run time, the whole client runtime. On a page that already holds the whole runtime the model's store stays the one store, with its state and subscribers.
|
|
20
|
+
- `FetchClient.setModelRuntimes(references)` is the one new static. Only the generated `refs.ts` needs it.
|
|
21
|
+
- The framework components that reach a model only through such an object no longer load the whole runtime. `Data.ListContainer`, `Data.QueryMaker`, `Data.RefPicker`, the `Signal` API explorer and `Constant.Doc` still do: they follow a model named by a field or a filter argument, which no object brought. They are loaded on demand, so a page pays for them only where one renders.
|
|
22
|
+
- A relation field (`Field.Relation` and the others taking a `slice`) loads the related model through the slice it is given, not the whole runtime.
|
|
23
|
+
- A `resets` name on `Model.New`, `Model.Edit` or `Model.View` whose store the page has not loaded is passed over, since there is no state to reset.
|
|
24
|
+
- The route table of `akan build` counts, for each route, the reference files of the models its server modules hand over. Where a server module picks a `fetch` name at run time, or takes `fetch` from the `server` barrel, the route counts every model's runtime and the build names the file and the line once.
|
|
25
|
+
- A handoff object that carries no reference works as before, wherever the page already holds the model's runtime.
|
|
26
|
+
|
|
27
|
+
**Upgrading.**
|
|
28
|
+
|
|
29
|
+
Until `lib/__client/refs.ts` exists (an `akan build` or `akan sync <app>` writes it) the app builds and serves with the whole client runtime and says so once, naming the sync. A spread (`{ ...init }`) or an `Object.assign` of what `fetch` returned keeps the reference; a deep copy (`JSON.parse(JSON.stringify(init))`, `structuredClone(init)`, a cache that stores the object as JSON) leaves `_runtime` an empty object. What that means for a page that builds or copies such an object by hand is in the upgrade note of the entry that makes every app load per route.
|
|
30
|
+
|
|
31
|
+
- edf14fd: A page registers the constants of the models its client code names, not every model's. A page that keeps the whole runtime still loads `lib/cnst.ts`; the one change there is that a registered model no longer carries its type-only `_`-prefixed members as `null` values.
|
|
32
|
+
|
|
33
|
+
- `akan sync` writes one registration piece per model and scalar, `lib/__client/<model>.cnst.ts`, which imports that module's constant file and the pieces of the models the file names, then registers the model. `lib/cnst.ts` keeps its shape and exports. A model's `.fetch` and `.st` pieces load its registration piece first, and so does a handoff reference (`<model>.ref.ts`), which loads one of them. A `.fetch` piece names the pieces it needs first in its own `FetchClient.build` call, so loading them first adds no statement to a page. A registration piece that no page loading only pieces reaches (only pages that also load the whole runtime, or only a handoff) takes its model from `lib/cnst.ts` instead, so those pages keep every constant in the one chunk they already share.
|
|
34
|
+
- The build rewrites `cnst.Memo`, `cnst.memo`, `cnst.MemoStatus`, a lib's `cnst.util.File` and `const { MemoStatus } = cnst` to imports of those names from the file declaring each; a type-only use loads nothing. A file keeps the whole `lib/cnst.ts` when it passes `cnst` on (as an argument, a spread, `Object.keys(cnst)` or another variable), picks a member with a computed key, names something `cnst` does not hand out, or hides names behind a rest or nested destructuring, and so does a constant file that reads its own app's or lib's `cnst`.
|
|
35
|
+
- A framework component that walks every registered model (the API explorer, the schema page, relation pickers, query makers) loads the whole runtime, `lib/cnst.ts` included, so it sees every model on any page. So does `Data.Dashboard`, whose tiles read their filters from a model a prop names: the server registers every model, so with fewer in the browser the tiles would render differently after hydration.
|
|
36
|
+
- Registering the same model or scalar again, from its piece and from `lib/cnst.ts` in one tab, returns the first registration; another class claiming a taken name still fails. A repeat is the same name with the same classes from the same constant file: a file that registers several names registers each, and a name that comes again with other classes registers those.
|
|
37
|
+
- In development, saving a `*.constant.ts` file reloads the tab, which registers the model before its fetch and store pieces run, as a built page does. The names a saved scalar file (`lib/__scalar/<name>/<name>.constant.ts`) declares are read again, as a model's are.
|
|
38
|
+
- The agent's form tools find the setters of a model a page registers after their first lookup.
|
|
39
|
+
- `akan quality runtime` notes each client or constant file that keeps every constant (`akan.runtime.whole-constants`), with its reason, and counts them per app and lib.
|
|
40
|
+
- The build's own check also fails when a registration piece is imported back by a file it loads, or when a page built to load pieces reaches `lib/cnst.ts` other than through a file `akan quality runtime` names or a registration piece answering from it. A page that such a file or piece already makes load every constant may reach them by another path too: a handoff reference no route hands over takes its models from `lib/cnst.ts`, and their constant files stay as written.
|
|
41
|
+
|
|
42
|
+
In the sample apps the memo pages of `apps/minimal` went from 263.5 KB to 262.3 KB and from 236.1 KB to 234.8 KB (brotli); every other route stays within 0.2 KB of before.
|
|
43
|
+
|
|
44
|
+
**Upgrading.**
|
|
45
|
+
|
|
46
|
+
Until the pieces exist (an `akan build` or `akan sync <app>` writes them) the build keeps the whole `lib/cnst.ts`. `akan quality runtime` lists the files that keep every constant and why; rewriting one to `cnst.<Name>` or `const { … } = cnst` lets its pages load fewer constants. What changes for code that looks a model up by name is in the upgrade note of the entry that makes every app load per route.
|
|
47
|
+
|
|
48
|
+
- 0a2f6dd: `akan sync` also writes each app's and lib's client runtime as one generated piece per module under `lib/__client/`, ready for a later release that loads a model's endpoint descriptors and store only on the routes that use them. Nothing imports the pieces yet: `lib/useClient.ts`, `lib/st.ts` and `lib/usePage.ts` are unchanged, and every route loads exactly what it loaded before.
|
|
49
|
+
|
|
50
|
+
- `<module>.fetch.ts` applies that module's endpoint descriptors onto the tab's fetch client, after the same module's piece of each lib it extends; `_base.fetch.ts` applies the descriptors every scope inherits from `akanjs/signal` itself.
|
|
51
|
+
- `<module>.st.ts` registers and builds that module's store alone, after the extended lib store's own piece.
|
|
52
|
+
- `_useClient.ts` imports every fetch piece of the scope and its libs and exports what `lib/useClient.ts` exports; `_st.ts` imports every store piece and exports `st`, `RootStore` and each store, as `lib/st.ts` does.
|
|
53
|
+
- `lib/sig.ts` exports one more build-time macro, `getSerializedSignalOf(name)`, which answers the descriptors one module brings, or with `"base"` the ones from `akanjs/signal`.
|
|
54
|
+
- `lib/__lib/lib.store.ts` imports each extended lib store from its own file instead of the lib's `client` barrel, and registers it when the lib's runtime has not yet, so an app store file imported on its own still has the lib store's actions.
|
|
55
|
+
- A server render reads a fetch piece's descriptors from the live server signal, as it does for `lib/useClient.ts`.
|
|
56
|
+
- `akan sync` removes the pieces of a module that was deleted or renamed.
|
|
57
|
+
- Adding a store root to a running store does work in proportion to the keys that root brings, not to every key already in the store, so building one root per module stays linear. A computed key that a later root adds now starts from the state as it is, so with a lib store's `count: 1` in place, an app store overriding `count: 10` and adding `tripled = computed(["count"], …)` starts at `tripled: 3` rather than 30.
|
|
58
|
+
- `lib/__client/` is listed with the other generated files: in the agent guide, the agent hook that stops hand edits, the Biome overrides, the code graph, and the `.gitignore` of a new workspace.
|
|
59
|
+
|
|
60
|
+
**Upgrading.**
|
|
61
|
+
|
|
62
|
+
Nothing to change in app code. The `.gitignore` lines for the new files are in the upgrade note of the entry that makes every app load per route.
|
|
63
|
+
|
|
64
|
+
- b5b4834: A production page now loads the endpoint descriptors and stores of only the modules its client code names. Before, a client module importing `fetch` or `st` from a `client` barrel brought every module of that app or lib.
|
|
65
|
+
|
|
66
|
+
- `akan build` reads each client file of the app and its libs. Where every `st.use.<key>()`, `st.do.<action>()`, `st.slice.<name>`, `fetch.<endpoint>()` and `sig.<module>` names something it can tell at build time, the file takes `fetch` and `sig` from `lib/usePage.ts`, `st` from `akanjs/store` (the tab's one store, the object a scope's `lib/st.ts` exports), and imports the `lib/__client/` pieces of the modules those names belong to, each by a name it hands to `loadedAfter` from `akanjs/base`, so the piece's chunk loads first however the build splits the code. A `*.store.ts` file gets its own module's descriptors and those of the modules its model depends on, and no store piece: a file naming a store loads the stores that store's file names.
|
|
67
|
+
- A file that picks a name at run time (`st.do[name]()`), or names something no generated piece answers, imports the app's whole runtime instead, as do the framework components that reach a model by a computed name (`Load`, `Model`, `Data` and the others importing `akanjs/ui/modelRuntime`). In development the whole runtime is assembled from the same pieces (`lib/__client/_useClient.ts`, `lib/__client/_st.ts`); in a build a client entry that needs every module keeps `lib/useClient.ts` and `lib/st.ts` as before, and the files only such entries reach are left as written. A `*.store.ts` file that picks a name at run time (spreading into the object given to its own `this.set` is not one) makes every file naming its store load the whole runtime.
|
|
68
|
+
- A lib file naming a lib module loads the app's piece of it, so a store the app extends arrives with the app's additions. The lib's own store file of that model is the exception: the app's piece is what loads it.
|
|
69
|
+
- A store piece whose model holds a file loads the upload module's descriptors first, so the piece alone has its upload action (`st.do.upload<Field>On<Model>`).
|
|
70
|
+
- An app store that extends a lib store and has no signal of its own loads the upload module's descriptors first too.
|
|
71
|
+
- An import that also takes a `client` barrel's default export (`import Kit, { st } from "@apps/<app>/client"`) is left as written and loads the whole runtime.
|
|
72
|
+
- An app store that extends a lib store answers what it answered before, whichever pieces a page loads and in whatever order: a default both declare is the lib's, an action or a `set<Key>` both declare is the app's. The store runtime itself is unchanged.
|
|
73
|
+
- The development server loads what a production page loads: a client module takes the pieces of the modules it names there too, so a name a route misses shows while you work, and the error for a store key the page has not loaded names the module whose store declares it.
|
|
74
|
+
- An app not yet synced to `lib/__client/_useClient.ts` and `_st.ts`, or whose module names cannot be read from source, builds with the whole runtime on every page, and the build says which of the two happened and names the sync to run. `akan sync` warns when it cannot read a scope's modules, and `akan build --write false` warns that it uses the `lib/__client/` files as they were last written.
|
|
75
|
+
|
|
76
|
+
**Upgrading.**
|
|
77
|
+
|
|
78
|
+
The `lib/__client/` files an earlier release wrote are written again by the sync `akan build` runs. A client module importing `fetch` or `st` no longer brings its whole app or lib; what to check for is in the upgrade note of the entry that makes every app load per route.
|
|
79
|
+
|
|
80
|
+
- ecb18a9: A page loads only the parts of an object it names: `Memo.Zone.View` brings `Memo.Zone.tsx` and not the model's other part files, and `Layout.Navbar` brings the navbar and not every layout part.
|
|
81
|
+
|
|
82
|
+
- In a build and in the development server alike, an import of an object whose file only gathers imports is rewritten to imports of the members the importing file writes out: `Memo.Zone.View`, `<Field.Text />`, `const { Util } = Memo`, and a member one level down such as `Constant.Doc.Zone`. Server rendering and the browser load the same part file.
|
|
83
|
+
- An object's file qualifies when, while it loads, it only declares names (imports, types, functions, `const` values, export lists) and puts members on objects it created above (`X.member = …`, `Object.assign(X, …)`), and nothing it evaluates calls a function, assigns or awaits. A file that imports a module only for its effect (`import "./x"`, `import {} from "./x"`), re-exports from another module, runs any other statement, calls a function such as `memo(…)`, or puts a member on an import or on a name it did not create keeps the whole object. So does an importing file that passes the object on, spreads it, reads a member with a computed key, renders or calls the object itself, writes to a member (an assignment, `++`, `delete`, a `for … of` target or a destructuring assignment), or calls a member through it (`Obj.run()`) that may read `this`: only an arrow function, or a function with no `this` outside its nested functions, is called on its own.
|
|
84
|
+
- A member of a `"use client"` object reached from a server file is narrowed only when the member's own file is `"use client"`, so the server still meets a client reference where it met one before.
|
|
85
|
+
- `export { a, b as c } from "<barrel>"` in an app or lib is narrowed to the files that declare those names, and a name a barrel's entry re-exports from a package resolves to that package.
|
|
86
|
+
- In development, saving a part file updates the page in place, adding an export to a part file and naming it from a page works without a restart, and pointing an object's member at another file rereads every page that reached it.
|
|
87
|
+
- `akan quality runtime` prints, per app and lib, how many object imports load only the members they name and how many load the whole object, by reason; `--format json` lists each of the latter with its file and line.
|
|
88
|
+
|
|
89
|
+
In the sample apps every route got smaller: the largest route of `apps/minimal` went from 469 KB to 319 KB, and the median route of `apps/akan` from 535 KB to 304 KB (brotli).
|
|
90
|
+
|
|
91
|
+
**Upgrading.**
|
|
92
|
+
|
|
93
|
+
A part file a page does not name no longer runs its top-level code on that page; what that can break is in the upgrade note of the entry that makes every app load per route. `akan quality runtime` shows what kept an object whole: per app and lib it counts the imports that load the whole object by reason (`call`, `reexport`, `method-call`, `written`, `passed-on`, …), and `--format json` lists each one with its file, line, object and reason. An object kept whole for a `call` loads every part, so moving the call (`memo(…)`) into the member's own file lets pages load parts again.
|
|
94
|
+
|
|
95
|
+
- 8720b88: `akan sync` writes one more generated file in every app and lib, `lib/usePage.ts`: the page runtime (`usePage`, `msg`, `Err`) and the tab's one fetch client, built with no endpoint descriptor, constant or store. `lib/useClient.ts` keeps its name and its exports and applies the scope's descriptors onto that client, and `client.ts` exports `usePage`, `msg` and `Err` from `lib/usePage`. This prepares loading a model's descriptors and store only on the routes whose client code imports them; for now every route loads what it loaded before.
|
|
96
|
+
|
|
97
|
+
- A client module that imports only `usePage`, `msg` or `Err` from an app or lib `client` barrel is rewritten to import `lib/usePage` alone, not the barrel's descriptors and stores. A module that imports anything else from the barrel keeps both, as before. Each client entry still imports the app's whole client runtime, so no page loads less yet.
|
|
98
|
+
- A server render keeps using the live server `fetch` of `lib/sig.ts`: the server bundle hands it to `lib/usePage.ts` as its client.
|
|
99
|
+
- A workspace whose generated files predate `lib/usePage.ts` builds as before until it is synced.
|
|
100
|
+
- `lib/usePage.ts` is listed with the other generated files: in the lib root allowlist, the agent guide, the agent hook that stops hand edits, the Biome overrides, the code graph, and the `.gitignore` of a new workspace.
|
|
101
|
+
|
|
102
|
+
**Upgrading.**
|
|
103
|
+
|
|
104
|
+
Nothing to change in app code. The `.gitignore` lines for the new file are in the upgrade note of the entry that makes every app load per route.
|
|
105
|
+
|
|
106
|
+
- 4ff5d5e: Every app loads its client runtime per route: a server-rendered page loads the stores, endpoint descriptors, constants and dictionary texts of the modules that page uses, not every module's. There is no setting for it, in `akan.config.ts` or anywhere else.
|
|
107
|
+
|
|
108
|
+
- A build or development server that cannot use the per-module files (never synced, written by an earlier release, a mounted lib not synced, a module that cannot be read) loads the whole runtime on every page, as before, and says so with the `akan sync` to run. `akan build --write false`, which skips the sync, says its files may be stale.
|
|
109
|
+
- A build that finds its own output would load a module before the piece it needs warns once, naming the files, builds every page on the whole runtime instead and succeeds. That warning is a bug in akan: report it with its text.
|
|
110
|
+
- `akan quality runtime` lists, after an `akan build`, the routes that load every text of the page dictionary under the file and line that cost it (`[dictionary] <file>:<line> <why>`); `--format json` carries every route. For an app with a build report it no longer prints the `akan.runtime.framework-marker` note, which counted every page importing a framework component that reads models by name; the build's `[reader]` line names the routes that component really holds. The `akan quality` reference page lists every rule the report prints and what to change in app code for each.
|
|
111
|
+
- A model's reference, which `fetch.slice`, `fetch.init<Model>`, `fetch.view<Model>` and `fetch.edit<Model>` hand to client components, loads that model's own store. Before, another module's store with a state field named like the model loaded with it.
|
|
112
|
+
|
|
113
|
+
**Upgrading.**
|
|
114
|
+
|
|
115
|
+
This is the one upgrade note for the per-route client runtime; the other entries of this release say what was built.
|
|
116
|
+
|
|
117
|
+
_With no action._ The first `akan build` or `akan start` after upgrading syncs the app and the libs it mounts, writing `lib/usePage.ts` and `lib/__client/` beside the other generated files, and its pages load per module. Add `apps/*/lib/usePage.ts`, `libs/*/lib/usePage.ts`, `apps/**/lib/__client` and `libs/**/lib/__client` to `.gitignore` beside `lib/useClient.ts` and `lib/__lib`. A build run with `--write false` and a lib no built app mounts need `akan sync <app-or-lib>` once; until then the pages load the whole runtime and the build says so. Server rendering, CSR bundles and native apps load everything, as before, and the development server loads what a production page loads. An app with routes to measure bundles its browser code at least twice, where it bundled once; `akan build --verbose` shows each bundle and its time.
|
|
118
|
+
|
|
119
|
+
_What can break, and how it shows._ A page no longer loads a module that no client file of its route names.
|
|
120
|
+
|
|
121
|
+
- A store or endpoint reached by a computed name without the app's or a lib's `client` barrel (the framework's base `st` or `fetch` with a string, a component library built on `akanjs/store`'s `st`, a file outside `apps/` and `libs/`) is found only on a route where a client file names that module. Outside React, `st.get().<key>` of such a store is `undefined`: a store's initial state and persisted keys appear when its code loads.
|
|
122
|
+
- An app store that extends a lib's store adds its actions, state and slices only on a route that loads the app's runtime, so code using them imports `st` from the app's `client` barrel, not the lib's.
|
|
123
|
+
- Top-level code runs only on the pages that name its file. A side effect other pages relied on because a store or a part file (`Memo.Zone.tsx`) imported it must be named by the pages that need it, or moved to where it is used. A member replaced at run time (`Obj.part = other`) is not seen by files that named the original member; read the object whole (pass it on) in the file that depends on the replacement.
|
|
124
|
+
- A slice, init, view or edit object written by hand (`{ refName, sliceName, … }`) or deep-copied (`JSON.parse(JSON.stringify(init))`, `structuredClone(init)`, a cache that stores it as JSON) carries no reference to its model, and neither does a slice parameter that is reassigned or has a default value. On a route where no client file names the model, the framework list, view or form finds no store: in development the error names the store's module and this cause, and in production the page shows nothing where the slice is read. `akan quality runtime` does not report this. Take the object from `fetch`, hand it over uncopied or spread (`{ ...init }`), or name the model in a client file of the route (`st.use.<key>()`).
|
|
125
|
+
- A model looked up by name (`ConstantRegistry.getDatabase("memo")`) is found only on a page that names it: name it in that file (`cnst.Memo`) or read `cnst` whole there. On every page, a registered model's `_`-prefixed member read as a value is `undefined`, where it was `null`; those members are types.
|
|
126
|
+
- A `"use client"` component that builds an endpoint's description key from data (`` l(`${module}.signal.${endpoint}.desc`) ``) gets the text on the server and the raw key in the browser: React reports a hydration mismatch and the key shows. Write the key out, or read the text in a server component and pass it down. A text shown once outside React, such as a toast that calls `Translator.translateByLocale`, can wait on `Translator.ready(lang, key)` so a late module's text is not shown as its key.
|
|
127
|
+
|
|
128
|
+
_How to check._ Run `akan build <app>`, then `akan quality runtime`: it names each file that keeps a page on the whole runtime or the whole dictionary, the line, the reason and the routes. `akan preview <app>` opens the pages and reports what they throw.
|
|
129
|
+
|
|
130
|
+
_How to keep a page on the whole runtime._ In app code: a route keeps the whole runtime when it renders a client file that exports the store, since any file may then read any module through it.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
// apps/<app>/ui/WholeRuntime.tsx
|
|
134
|
+
"use client";
|
|
135
|
+
import { st } from "@apps/<app>/client";
|
|
136
|
+
|
|
137
|
+
export const wholeRuntime = st;
|
|
138
|
+
|
|
139
|
+
export const WholeRuntime = () => null;
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Render `<WholeRuntime />` in one page to keep that route, or in the root layout (`page/_layout.tsx`) to keep every route. `akan quality runtime` then lists the file under `[reader]` with the routes it holds. A route kept this way loads more than before, so `akan build --check-budget` may name it; `akan build <app> --raise-budget` raises its entry. Use it to ship while the files `akan quality runtime` names are changed, or for a route that reaches a store, an endpoint or a model by a name the build cannot read.
|
|
143
|
+
|
|
144
|
+
- a708a40: A server-rendered page starts from a small page runtime, the first step toward loading a model's endpoint descriptors and store in the browser only on the routes that use them.
|
|
145
|
+
|
|
146
|
+
- Each client entry of a server-rendered page starts from `lib/usePage.ts` (`usePage`, `msg`, `Err` and a fetch client carrying only the framework's own descriptors, such as `ping`, from `lib/__client/_base.fetch.ts`) instead of `lib/useClient.ts` and `lib/st.ts`. A client module that imports `fetch` or `st` from an app or lib `client` barrel still brings that scope's descriptors and stores, and a lib's barrel brings that lib and the libs under it.
|
|
147
|
+
- The framework components that reach a store, an endpoint or a registered constant by a name they compute (`Load`, `Model`, `Data`, `Signal`, `Constant.Doc` and the relation fields) import an empty module, `akanjs/ui/modelRuntime`. A route build keeps the app's `lib/useClient.ts` and `lib/st.ts` in every client entry reaching it, so a page rendering one of them loads the app's whole runtime before the component runs. A test in `akanjs` fails when a `ui` file reaches a model that way without importing it.
|
|
148
|
+
- Server rendering, CSR bundles (MCP App views included) and native apps keep loading the whole runtime. The development server narrows imports from `akanjs/ui` as a production build does, so a missing import shows there too.
|
|
149
|
+
- An app whose generated files predate `lib/usePage.ts` or `lib/__client/_base.fetch.ts` builds with the whole runtime on every page until it is synced.
|
|
150
|
+
- `StoreBootstrap.importLines` and `StoreBootstrap.source` in `@akanjs/devkit` take an optional scope, `"whole"` (the default) or `"page"`.
|
|
151
|
+
|
|
152
|
+
**Upgrading.**
|
|
153
|
+
|
|
154
|
+
What a page stops loading, and what to check for, is in the upgrade note of the entry that makes every app load per route.
|
|
155
|
+
|
|
7
156
|
- 217b061: `akan code` on the default `local` profile now asks before it runs a shell command, as it already did before reaching an unlisted host. File reads, writes and edits are not asked about.
|
|
8
157
|
|
|
9
158
|
**Upgrading.** An interactive `akan code` session shows `approve? run: <command> [y/n/a]` before each shell command; `a` answers yes and stops asking about that command until the session ends. Pass `--no-ask-commands` to run them unasked as before, or `--no-ask` to stop the network questions as well. A one-shot `akan code "<prompt>"` and a sub-agent have nobody to ask, so their commands run as before. A program that drives `akan code --rpc` on the `local` profile receives an `approval` event for each command and answers it with `approve`, as it does for the `web` profile's writes; `codeAgentPresets.local(root).approval` is now `"commands"`.
|
|
@@ -61,6 +210,7 @@
|
|
|
61
210
|
|
|
62
211
|
An app built with the akan-native CLI's own config grants the same in its capabilities: `{ identifier: "external-view:default", allow: [{ origin: "https://board.example" }] }`, `"external-view:allow-evaluate"` and `"external-view:allow-sendKey"`. A grant of `external-view:all` or `external-view:allow-open` opens no origin unless its own `allow` lists them. A page that passed `window` to `open` passes its own window or leaves it out.
|
|
63
212
|
|
|
213
|
+
- 1712cf0: The image carries `bin`. `akan build` fetches each `bin` entry's `linux-x64` and `linux-arm64` file into the build's `bin/amd64/` and `bin/arm64/`, and the generated Dockerfile puts the folder its `TARGETARCH` names first on PATH, so an executable the server spawns is declared once for the image and the desktop app. An entry with no Linux file is still left to `docker.preRuns`; one that has both now runs the carried file, which is ahead on PATH. An app that writes its own Dockerfile adds `ENV PATH=/workspace/bin/$TARGETARCH:$PATH` itself, and the build says so. `akan start` warns when a declared executable is not on the computer's PATH. The byte budget of the `akan-runtime` skill's `runtimeRule-3.md` is raised on purpose for the new text.
|
|
64
214
|
- 8d75f2b: The public surface 3.2.0 deprecated is removed. `akanjs` and `@akanjs/devkit` publish only the subpaths their `exports` name, with no wildcard, so a file becomes public only when an entry names it.
|
|
65
215
|
|
|
66
216
|
- **`@akanjs/devkit` has no root aliases and no `./*` or `./*.ts`.** It publishes `@akanjs/devkit` (types only), `biome.base.json`, the facets `akanApp`, `akanConfig`, `artifact`, `cloud`, `codeAgent`, `commandDecorators`, `executors`, `frontendBuild`, `incrementalBuilder`, `mobile`, `pipeline`, `preview`, `transforms` and `workflow`, and the files `app/applicationBuildRunner`, `cloud/cloudApi`, `cloud/cloudUpdates`, `commandDecorators/exitCodeError`, `mobile/desktopRelease`, `mobile/serverBundleSecrets` and `transforms/serverEnvProfile`. `util/fileEditor`, `util/selectModel` and `workspace/getRelatedCnsts` are named too, and deprecated: nothing in akanjs uses them.
|
|
@@ -80,6 +230,61 @@
|
|
|
80
230
|
- `MAX_INT` → `2 ** 31 - 1`. `isFilterModel(ref)` → `getFilterMeta(ref, { allowEmpty: true }) !== undefined`. `setFilterInfoByKey` → declare the query with `from(model, (filter) => …)`. `getDefaultSchemaOptions()` → `new DocumentSchema()`. `runWithTrace` → `runTraced`, only where the caller owns the trace, since it finalizes it. `traceDbQuery(ms)` → `getCurrentTrace()?.countDbQuery(ms)`. `isSitemapPath(pathname, basePaths)` → `getSitemapBasePath(pathname, basePaths, headerBasePath) !== undefined`. `useRscNavigation` → `navigateRsc`, `clearRscNavigationCache` and `isRscNavigationFromCache`. `getSearchParam` and `getBaseSearchParam` → read `searchParams[key]`, taking the first value of an array. `dictionaryContext`, `groupByOwner` and `ServiceRegistry` have no replacement.
|
|
81
231
|
- No longer exported, with no replacement: `setFilterMeta` and `getFilterArgInfo` (`akanjs/document`), `isDebugHeaderAllowed` (`akanjs/signal`), `parseAkanConsoleQuery`, `createAkanConsoleLogCommands` and `createAkanConsoleContext` (`akanjs/server`), `isResponsiveInset`, `getClientRuntime`, `colorTokens` and `radiusTokens` (`akanjs/client`), and `isStateBuilderMarker` (`akanjs/store`).
|
|
82
232
|
|
|
233
|
+
- bfa67d8: The descriptions of API endpoints leave the dictionary file every page loads, and load only on a page that shows them.
|
|
234
|
+
|
|
235
|
+
- `akan build` and the development server write two files per language under `/_akan/dict`: the page dictionary, without the `.desc` and `.arg` texts of each `signal` entry, and an API file holding exactly those. The page file names the API file in an exported `parts` map. The endpoint labels stay in the page file.
|
|
236
|
+
- Each `Signal` component of `akanjs/ui` that shows an endpoint's description or argument texts, `Signal.Arg.Table` rendered on its own included, loads the API file before it shows them: a server-rendered page preloads it and carries its texts in the HTML, and a client navigation into such a page waits for it. A page showing no description never requests it. A file that fails to load is retried once; after a second failure the page shows without descriptions and logs the error, and the next navigation tries again.
|
|
237
|
+
- The server, MCP, the API and schema reference routes and a CSR build keep the whole dictionary.
|
|
238
|
+
- `TranslatorState` merges the files of a language into its dictionary, each file once. A language switch keeps each language's merged files to that language, and a file arriving after its language moved to another build is dropped. A page dictionary asked for before another of the same language but answering after it no longer replaces the newer one.
|
|
239
|
+
- `akan build` prints one line per language with the brotli size of each file: `Dictionary en: 4.9KB brotli on every page, API descriptions 836B where shown`.
|
|
240
|
+
- `DictionaryAssetBuilder.build` in `@akanjs/devkit` takes an option `{ splitApi }`.
|
|
241
|
+
|
|
242
|
+
**Upgrading.**
|
|
243
|
+
|
|
244
|
+
A `"use client"` component of your own that writes an endpoint's description or argument key out (`l("<module>.signal.<endpoint>.desc")`) brings the API file to its route. What happens to one that builds the key from data is in the upgrade note of the entry that makes every app load per route.
|
|
245
|
+
|
|
246
|
+
- 6f8f6aa: A page loads the dictionary texts it can show rather than every module's.
|
|
247
|
+
|
|
248
|
+
- **What a route can show.** `akan build` and the development server read the keys each route's client modules name: a written key, a template whose module name is written, and a key picked from literal values or property names of an object in the same file, from a typed union, or from a template type with a written module name. To those they add the models, scalars and enums whose labels and options the framework's lists, views, forms and remove dialogs build at run time, reached through the module pieces the route loads, and `base`. A route that hands the translator on or keeps it in a variable, or has a key the build cannot follow, such as one read from data, loads the whole page dictionary, and `akan build` warns with its file, line and reason. A route that renders a `Signal` or `Constant` component loads the whole page dictionary too, and so does a route that keeps the whole client runtime, whose files `akan quality runtime` names. Server components need nothing: their texts arrive rendered.
|
|
249
|
+
- **Files.** Each language's dictionary is packed into files by module, sized on the default language, so that a route loads at most four of them besides the API description file. Each file is written to `/_akan/dict` with the table naming the file of every module. A route whose client components name an endpoint's description or argument key loads the API description file with them.
|
|
250
|
+
- **Loading.** A server-rendered page preloads its route's files and merges them before hydration; a client navigation merges the next route's files before the new page commits; a language switch loads that language's files. Each file is requested once per language, and a file that fails is tried again.
|
|
251
|
+
- **Safety net.** A key of a module the route's files leave out loads that module's file, and the page renders again once it merges, so the key shows only until then. A toast from `msg`, an action error or an agent message waits for its text rather than showing the key. Development logs the first such key of each module once; production never throws.
|
|
252
|
+
- **Development.** `akan start` writes one file per module and loads what each route's build counted, so saving a `*.dictionary.ts` file updates the page as in production. The save restarts the backend, and a page open meanwhile now takes the new texts without a reload: `RenderState.dictionaryStamp` names the dictionary files the backend serves, and the development socket's greeting carries it. A route's modules are read when it builds, so a key added to a client file and saved shows as the key, with that log, until the route builds again.
|
|
253
|
+
- **Unchanged.** The server, MCP and the single-file CSR build that native apps load keep the whole dictionary inline.
|
|
254
|
+
- **Size.** In the framework's sample apps, the English dictionary a first visit downloads drops from 4.9 KB (brotli) to 2.5 KB on the median route of `minimal`, and from 5.0 KB to 4.0 KB on `akan`, in one request on the median route and at most two. The loader adds about 1.4 KB to every route's JavaScript.
|
|
255
|
+
- `akan build` prints one line per language: `Dictionary en: first visit 2.5KB / 2.5KB / 3.0KB brotli on the lightest / median / largest route (whole 5.0KB), API descriptions 846B where shown`.
|
|
256
|
+
- `Translator.ready(lang, key)` answers `null` when the key's module is loaded, or a promise settling once it is. `DictionaryAssetBuilder.buildAll` in `@akanjs/devkit` takes `{ routes, everyGroupAlone }` beside `{ splitApi }`.
|
|
257
|
+
|
|
258
|
+
**Upgrading.**
|
|
259
|
+
|
|
260
|
+
A client component whose key the build cannot follow makes its route load the whole dictionary, and `akan build` names it: writing the key out, or picking it from an object or union in the same file, lets the route load only its own files. A text shown outside React is covered in the upgrade note of the entry that makes every app load per route.
|
|
261
|
+
|
|
262
|
+
- ee302c4: A page loads less of the framework's own UI code: the icons its files name rather than whole `react-icons` sets, no agent library unless it has an agent, no spring library for a dialog, and the gesture library only when a sheet is first pressed. This applies to every app; what a page shows and how it behaves do not change.
|
|
263
|
+
|
|
264
|
+
- **Icons.** A production browser build rewrites each named import from a `react-icons/<set>` package to a module written to the app's `.akan/generated/react-icons`, and each icon lives in exactly one such module: the naming file's own when one file names it, the app's shared module for that set when only the app's files name it, or the set's module shared with the workspace's libs and the framework when one of them names it too. A page loads each icon it uses once, and can carry the other icons of a shared module it touches, never more of a set than the whole set held. A name the set does not define as a plain icon, a namespace or default import, and a re-export keep the set. The server bundle keeps the set, and both draw the same markup. The development server already loaded icons per file.
|
|
265
|
+
- **Agent.** A server-rendered page no longer loads `use-agentic` for its page gate, so a page without an agent ships only the part of it that `akanjs/store` uses. `Agent.Chat`, `useAgent` and `SessionContext` work as before.
|
|
266
|
+
- **Dialog.** `Dialog.LegacyModal` loads the first time it renders, behind its own Suspense boundary, so `<Dialog>`, `Dialog.Modal` and `Modal` no longer load it or `@react-spring/web`. `Dialog.LegacyModal` remains a member of `Dialog`.
|
|
267
|
+
- **Drag to dismiss.** `BottomSheet`, `Dialog.Modal` and `Dialog.LegacyModal` load `@use-gesture/react` on the first press of their drag handle; the events that arrive while it loads are replayed into it, so the first drag, its flick speed and a tap land as a later one does.
|
|
268
|
+
- **Field.** `Field.Text` and `Field.TextArea` are memoized in their own file, so `Field`'s file only gathers its members: a page that names `Field.Text` loads that kind's file and not every kind, and a server component that names only members can render it. In a CSR bundle `Field` stays one client module, as before.
|
|
269
|
+
|
|
270
|
+
**Upgrading.**
|
|
271
|
+
|
|
272
|
+
Nothing to do, with one change in timing: `Dialog.LegacyModal`, and the top-level `LegacyModal` that renders through it, load in a chunk of their own, with `@react-spring/web`, the first time they render. A legacy modal mounted only when it opens therefore shows its first open one chunk load later; it then springs in from transparent as a later open does, nothing is drawn in its place meanwhile, and the open is not lost. A test that expects its content in the first render must wait for it.
|
|
273
|
+
|
|
274
|
+
- 62bcf74: A client file that names a store, a slice or an endpoint in one of the common indirect ways now loads only the modules it names, where before it kept the whole client runtime for itself and for every page reaching it.
|
|
275
|
+
|
|
276
|
+
- **A cast hides nothing.** `(st.use as Loose).memoList()`, `const { self } = st.get() as Wide`, `!`, `satisfies` and `<T>value` are read as the name written after them. A name the runtime does not have is reported as an unknown name, a computed key stays computed, and an object handed on stays handed on. `const get = st.get` called later reads the state as `st.get()` does, and the framework's `fetch` cast to the app's is read as the app's.
|
|
277
|
+
- **A key asserted as a name is read as that name.** `st.slice[sliceName as "memo"]`, or `const key = name as "memoList"` followed by `const { [key]: list } = this.get()`, `this.set({ [key]: list })` or `this.pick(key)`. Asserting a key as a name tells the build the value is that name or one owned by the same module. A union of names counts as each of them.
|
|
278
|
+
- **A name built from a slice the function is handed.** `` st.use[`queryArgsOf${capitalize(slice.sliceName)}`] `` loads nothing of its own when `slice` is a parameter or prop typed `SliceMeta` of `akanjs/fetch` and the name is put together from its `sliceName` or `refName` with `capitalize` of `akanjs/common`, a template or `+`: the slice arrived with its model, from `fetch` or `st.slice` in a client file or from the server with the model's reference. Where a name it may stand for belongs to a module that arrival does not load, the file loads that module itself.
|
|
279
|
+
- **A slice written out by hand in a client file loads its model.** `{ refName: "memo", sliceName: "memoInBoard", argLength: 0 }` is read as naming `memoInBoard`; with names that are not written out the file keeps the whole runtime. A `sliceName` copied from a handed `SliceMeta` parameter (`{ refName: slice.refName, sliceName: slice.sliceName }`, or the same names taken out by destructuring) loads nothing, and a server module doing so no longer makes the route count every model's reference.
|
|
280
|
+
- **State handed to a function of the same file** (`MemoStore.announce(this.get())`, a `const` arrow, a function declaration or a static method) is read where that function reads it.
|
|
281
|
+
- **`akanjs/store/agent`.** `ScreenSettle`, `ScreenTarget`, `ScreenReader`, `ScreenFlash`, `ScreenImage`, `AgentCursor`, `AgentVisual` and `AgentPrompts` no longer keep the whole runtime; `AgentBridge` and `AgentContext` hold the root store's registry, `StoreSurfaceSource` reaches it through `AgentBridge` and keeps one surface per page on `globalThis`, and `StoreCatalogue` imports only types of the store but lists every model in the constant registry; those four still keep the whole runtime.
|
|
282
|
+
- The note of `akan quality runtime` for a read that still keeps the whole runtime now ends with what to write instead: assert the key as a name, name the endpoint, take the slice as a parameter, or read the names where the object is. The `cast` reason is gone from its output.
|
|
283
|
+
|
|
284
|
+
**Upgrading.**
|
|
285
|
+
|
|
286
|
+
A client component that builds a store or endpoint name from a slice it was handed now relies on that slice arriving with its model; before, the reading file kept the whole runtime. What that means for a slice written or copied by hand is in the upgrade note of the entry that makes every app load per route.
|
|
287
|
+
|
|
83
288
|
- 6e5da23: `akan build` no longer puts the secret values of `env/env.server.<env>.ts` into the server it builds. The server reads each one from an environment variable when it starts, and says at boot which ones its deployment has not set.
|
|
84
289
|
|
|
85
290
|
- **What counts as a secret.** A string under a secret-sounding key (password, secret, token, apiKey, privateKey, accessKey, webhook, …), at any depth below it, or a URL with a password in it. It is the rule a desktop profile build already applies and the logger masks by, now also for a key named `aesKey`. Numbers, booleans, `null` and every other string stay in the build as before.
|
|
@@ -190,8 +395,64 @@
|
|
|
190
395
|
|
|
191
396
|
A chat where the user mentions a record now asks before the first change that follows. `AgentConfirm.set({ afterScreenRead: false })` turns that off together with the ask after `readScreen`.
|
|
192
397
|
|
|
398
|
+
- e5d3cac: An `Agent.Zone`'s label and a value published with `st.expose`, `st.useState` or `useAgentResource` reach the model the way route params and store keys do: ids, enum members, numbers and booleans in the turn's context, free text through a read tool.
|
|
399
|
+
|
|
400
|
+
- **A published value rides in the `screen` block only when it is the app's own kind of data.** A string rides when it is one token (the rule route params follow) or an ISO timestamp, beside numbers, booleans and `null`. A list rides when every item does and it spells at most twelve words; a list with free text in it is left out whole. An object keeps its fields of that kind, at most twelve of them and twelve words of values, under names that are tokens. A resource with anything left out is marked `withheld: true`, and one whose read threw is listed with no error text.
|
|
401
|
+
- **`readState(name)` answers a published value.** The name is the one the `screen` block lists, a zone's prefix included. The answer is the whole value, as page content, so the first change after it asks the user first. A store key the screen reads is answered before a published value of the same name.
|
|
402
|
+
- **A zone's `label` rides only when it is one token.** `readScreen` with `section` set to the zone's path, or with no `section` inside the zone's own chat, starts with a `Zone label:` line when the label was left out.
|
|
403
|
+
- `StoreSurfaceSource` takes the surface it is attached to as its second argument, `AgenticSurface.shared` by default.
|
|
404
|
+
- The agent guideline and the `akan-agent` skill describe the rule.
|
|
405
|
+
|
|
406
|
+
**Upgrading.** A model that read a sentence from `st.expose`, `st.useState`, `useAgentResource` or a zone's `label` in the turn's context now finds the resource marked `withheld` and reads it with `readState`, which makes the next change ask for approval. Where an agent should act on a value without that ask, publish an id, a count or an enum member. A host that builds its own `StoreSurfaceSource` on a surface other than `AgenticSurface.shared` passes that surface to it.
|
|
407
|
+
|
|
193
408
|
- a291bbb: The path rules an agent loads with every service, signal, page and `.tsx` file are shorter: the `server`, `style` and `ssr` rules keep only what fails the build or silently changes behaviour and point at the skill that explains the rest (server 7.9 KB to 2.4 KB, style 5.8 KB to 2.5 KB, ssr 3.6 KB to 1.9 KB), and the `akan-page` skill no longer repeats what the `page` rule already says. Nothing was dropped: an endpoint's `errors` option and where an adapter's error keys live are now in the `akan-err` skill, the request-schema check in `transportRule`, and the `cn`, multi-slot and enum-to-class conventions in `cssRule`. `cssRule` and `recipeRule` now say the framework recipe list is in the `style` rule, and the API reference says what `akanjs/dictionary`, `document`, `service`, `store`, `client/native`, `native/desktop` and `test` hold. Run `akan agent install` in a workspace to pick up the new files.
|
|
409
|
+
- f678e80: The skills no longer repeat the path rule an agent has already loaded for the same files: `akan-query` points at the `module` rule for its musts (500 rows, soft removal, hookless writes, secret projections, cascade direction), `akan-transport` at the `auth` rule for guards and drops what the `server` rule says about body types, the 30-second default deadline and remote errors, `akan-service`, `akan-err` and `akan-mcp` at the `server` rule, and `akan-ui`, `cssRule` and `componentRule` at the `style` rule for class order and the colour vocabulary. The `server` rule drops its in-page agent line, which the `akan-agent` skill already holds and which no service, signal or document file needs. Run `akan agent install` in a workspace to pick up the new files.
|
|
194
410
|
- c44d068: A coding agent reads less to build its first app: the `akanjs` README keeps the path to a first app and links the rest on akanjs.com (17 KB to 7 KB), the `akan-page` and `akan-service` skills ship the API reference one section at a time with every entry named in the skill's index (`Link` now lists the anchor attributes it takes and `Link.Back`, `Link.Close` and `Link.Lang`), the `akan-page` skill holds what a first page looks up while `pageRule` keeps the deeper contract, and each rule is stated once across AGENTS.md, the path rules and the skills. Run `akan agent install` in a workspace to pick up the new files.
|
|
411
|
+
- 55d1518: A production build of a workspace with several libs loads its client modules in order, and a page that needs every module weighs what it weighed before.
|
|
412
|
+
|
|
413
|
+
- Each generated piece exports a name, and a module that needs the piece imports that name and hands it to `loadedAfter` from `akanjs/base`. A piece imported only for its effect could end up in a chunk the importer's chunk did not load first; a store or an endpoint was then read before it existed.
|
|
414
|
+
- A store file, and every file a store file imports, loads no store piece. The stores its code names are loaded by each file outside that imports it or names its store, so no store file is defined through a piece that imports it back. Where the importing file is one the build leaves as written (it holds a macro import, or lies outside `apps/` and `libs/`), the page keeps the whole runtime.
|
|
415
|
+
- A store spreading a value into the object it gives its own `this.set` (`this.set({ ...patch })`) no longer counts as picking a name at run time. A value or a function handed over whole (`this.set(patch)`, `this.set(update)`) still does, since an updater may read any module's state. `fetch.ws`, `fetch.http`, `fetch.origin`, `fetch.jwt`, `fetch.logger`, `fetch.setJwt`, `fetch.setTimeout`, `fetch.connect`, `fetch.connectOnUse`, `fetch.disconnect` and `fetch.configureWs` are the fetch client's own members, not endpoint names.
|
|
416
|
+
- A client entry that reaches a file needing every module keeps the whole runtime, as does an entry held only by pages with such an entry, and one naming a module that more such pages hold than other pages. Their files are left as written, so the page loads the code it loaded before.
|
|
417
|
+
- `akan build` checks its output before it serves it: every chunk holding a module that needs a piece reaches the chunk holding that piece, no store file sits in an import cycle with a piece, and no entry built to load pieces reaches a file needing every module. On a failure the build warns once with the two source files named, builds every page on the whole runtime instead and succeeds; the warning is a bug in akan to report. The development server serves each module on its own and checks nothing, so the production build is the guard.
|
|
418
|
+
- `akan quality runtime` adds a note, `akan.runtime.framework-marker`, per file that brings a framework component reading models by name (`Field`'s relation fields, `Load`, `Model`, `Data`, `Signal`, `Constant.Doc`) onto a page: the imports from that file to the component, and the pages that load the whole runtime through it.
|
|
419
|
+
|
|
420
|
+
Nothing to do. A file outside every app and lib that imports a `lib/__client/` piece by hand should import the piece's exported name and pass it to `loadedAfter`; the build's check names it otherwise.
|
|
421
|
+
|
|
422
|
+
- c183ac9: A page loads per module only where that makes it smaller, and a page that keeps the whole runtime no longer carries a module's API descriptions twice.
|
|
423
|
+
|
|
424
|
+
- `akan build` sizes every route twice: as the analysis planned it, and with every client entry keeping the whole runtime. A route no smaller per module is built again keeping the whole runtime, and stays that way only if it then came out smaller than it was; otherwise it loads per module as planned. The build says what it did in one line: `N routes load per module, M keep the whole runtime because per module would not be smaller`. `akan quality runtime` names the first routes of each kind (`--format json` names all), and the build lists them at the `verbose` log level.
|
|
425
|
+
- A page keeping the whole runtime beside pages that load per module took a module's API descriptions from `lib/useClient.ts` and again from that module's `lib/__client/*.fetch.ts` piece. Now `lib/useClient.ts` leaves out what those pieces hold and loads the pieces first, so each description ships once.
|
|
426
|
+
- A client entry that no per-module page loads keeps the whole runtime wherever some page does, so the files it shares with that page bring no pieces to it.
|
|
427
|
+
- The build warns when a route still loads a scope's whole file together with a piece repeating part of it.
|
|
428
|
+
- `akan quality runtime` prints what the last build of each app decided: the routes loading per module, and for every entry keeping the whole runtime the file and line to change, or the rule that keeps it.
|
|
429
|
+
- An app with routes to measure bundles its browser code at least twice instead of once: as planned, with everything whole, and then once per round of routes it tries keeping whole, six rounds at most (two to four bundles in the apps measured so far). An app whose every route keeps the whole runtime for a reason in a file bundles once, as before.
|
|
430
|
+
|
|
431
|
+
- 1e826a7: A build reads each scope's signal once, not once per generated `lib/__client/*.fetch.ts` piece, so an app with many modules builds about as fast as it did when every page loaded every module. The development server reads them once per compile round that holds a piece, and again for a file it has to build on its own.
|
|
432
|
+
|
|
433
|
+
- Each piece gets its module's descriptors written in where it called `getSerializedSignalOf`. A new read runs in a process of its own each time, so an edit to a signal between two builds is never served stale. That process sees the build's own environment and `define`, and no `.env` file the build did not load.
|
|
434
|
+
- A piece the read cannot answer exactly keeps running its macro as before. So do the pieces of a scope whose signal fails to load, or does not load within 60 seconds. The build names that scope, and the pieces of every other scope are still answered.
|
|
435
|
+
- The process reading the signals ends with the build that started it.
|
|
436
|
+
- The pages a build writes carry the same code as before; only the names the minifier picks for a few local variables can differ.
|
|
437
|
+
|
|
438
|
+
- b5b4834: The development server now loads what a production page loads, so a page that works in development works the same once built.
|
|
439
|
+
|
|
440
|
+
- A server-rendered page in development takes the descriptors and stores of only the modules its client code names, from the same `lib/__client/` pieces a route build uses, and imports from `akanjs/ui` narrow as they do in a build. The tab keeps one store, and each piece loads once.
|
|
441
|
+
- Saving a store, signal or constant file rereads which module declares each name and recompiles the files whose names moved to another module. A store save that adds an action replaces that store's actions and keeps its state, without reloading the page.
|
|
442
|
+
- Saving a lib's store file or store piece runs the app's piece of that module and the app's assembled store again after it, and the app's store of that model too when it extends the lib's, so a lib store the app extends keeps the app's actions.
|
|
443
|
+
- A component saved to name another module loads that module's piece without reloading the page; a file saved to pick a name at run time loads the whole runtime.
|
|
444
|
+
- An app whose `lib/__client/` files, or a mounted lib's, are missing, or whose modules cannot be read, loads the whole runtime in development as a build does. The development server says which once, names the sync to run, and loads per module again on the next save after that sync, with no restart.
|
|
445
|
+
- Reading a store key the page has not loaded fails with the name of the module whose store declares it, and says to name the key in the file that reads it or import `st` from the app's `client` barrel there. The list of each store's keys behind that message exists only in development: a production bundle carries neither the list nor the message.
|
|
446
|
+
|
|
447
|
+
- 170fa28: A page downloads the framework's `akanjs/client` code once. A production build used to bundle the `akanjs/client` files that the framework's UI imports by path into the page's own chunks, beside the copy the page's server-rendering client already loaded, so a page ran two copies of them, each with its own state (`Device.instance` among it). Both now come from one browser entry for `akanjs/client`, which, like the other framework entries, holds only the names the app uses. This applies to a page loading per module and to one keeping the whole runtime alike; what a page shows and how it behaves do not change.
|
|
448
|
+
|
|
449
|
+
- **Size.** In the framework's own sample apps each route loads 9 to 17 KB (brotli) less when it loads per module and 9 to 50 KB less when it loads every module. A page loading per module can make one more request, for the `akanjs/client` entry; a page loading every module makes the same number or fewer.
|
|
450
|
+
- **Which files.** A file comes from the entry when the `akanjs/client` barrel re-exports all of it under its own names, whether the importer names `akanjs/client`, a path into it, a relative path, or a path through a linked `akanjs` install. A file the barrel leaves out or renames, such as `akanjs/client/native`, any dynamic `import()`, and a file of another framework entry imported by its path stay in the page's chunks. The native bridge behind `akanjs/client/native` is therefore still written into both builds, because the entry's `Device` and `storage` import it lazily, but only the CSR shell loads it.
|
|
451
|
+
- **Development.** `akan start` serves those files from its whole `akanjs/client` entry as well, so a development page runs one copy of the client's state; a few stateless helpers the framework's UI imports by path (`cn` among them) still load beside it from the development module registry.
|
|
452
|
+
- **Unchanged.** The single-file CSR build that native apps load and MCP App views carry one copy, as before.
|
|
453
|
+
|
|
454
|
+
Nothing to do. A workspace on an older `akanjs` without the `akanjs/client` entry builds as it did.
|
|
455
|
+
|
|
195
456
|
- 19c6fa7: `akan code` on the `local` profile can be told to stop asking about a command for the rest of the session, and one option turns asking off for a run.
|
|
196
457
|
|
|
197
458
|
- **A third answer.** The prompt before a shell command is now `approve? run: <command> [y/n/a]`. `a` runs the command and stops asking about it until the session ends. What is remembered is the program, and the sub-command too for `git`, `bun`, `bunx`, `npm`, `npx`, `pnpm`, `yarn`, `akan`, `docker`, `kubectl`, `helm`, `cargo` and `go`: allowing `git status` leaves `git diff` asked about, and allowing `bun test` leaves `bun x` asked about. `gh` is remembered two words deep, so allowing `gh pr view` leaves `gh pr merge` asked about. A line of several commands (`&&`, `;`, `|`, `$(…)`, a subshell) runs unasked only once every command in it is allowed. `/allowed` lists what the session has allowed and `/allowed clear` forgets it. Nothing is written to disk, so a resumed, forked or reloaded session asks again.
|
|
@@ -202,6 +463,12 @@
|
|
|
202
463
|
|
|
203
464
|
**Upgrading.** No step is needed: the three wire fields in `akanjs/common` (`CodeAgentApprovalRequest.remember`, the `approve` command's `remember`, `approval_resolved.remembered`) and `CodeTranscriptPart`'s `remembered` are optional additions.
|
|
204
465
|
|
|
466
|
+
- 9c538dc: `akan workflow plan` and `apply` for `create-ui` now write a Zone or a Util, for a database module and for a service module.
|
|
467
|
+
|
|
468
|
+
`--surface zone` and `--surface util` were advertised but apply refused them. They now write `<Model>.Zone.tsx` and `<Model>.Util.tsx` from the module templates. In a service module (`lib/_camera`, named `camera` or `_camera`) they write a small `Main` Zone or `Action` Util; `view`, `unit` and `template` stay refused there, since a service stores no model. `create-ui` also refuses, at plan and at apply, to overwrite a component file that already exists, which `view`, `unit` and `template` used to do silently.
|
|
469
|
+
|
|
470
|
+
A service module's `<Service>.Zone.tsx` and `<Service>.Util.tsx` now count as client files by role for `akan.ssr.unnecessary-use-client`, as a database module's do, so the new scaffold is not warned about before it reads the store.
|
|
471
|
+
|
|
205
472
|
- 1d8c8c2: An app with `basePaths` keeps every base path's CSS class scan in the candidate cache, so a start or build no longer rescans the sources of all but one of them. An entry is dropped only once its source file is deleted.
|
|
206
473
|
- 53bf2de: A problem in an env file is reported without the file's text, so a build or lint log holds no secret.
|
|
207
474
|
|
|
@@ -220,6 +487,7 @@
|
|
|
220
487
|
- 6ea7242: `akan build`, `akan verify` and `akan start` stop with an error naming the import chain when the server pages bundle would import `react-dom/server` as it loads, instead of building a bundle whose RSC worker throws "react-dom/server is not supported in React Server Components" at boot. A module in the page graph that dynamically imports the app's `server.ts` is the usual cause: it brings the whole server, SSR renderer included, into the pages bundle.
|
|
221
488
|
- 0d5e75e: A stylesheet whose imports use no Tailwind (no `@import "tailwindcss"`, Tailwind at-rule or `theme()` function anywhere in its import graph) is no longer run through the Tailwind compiler: its imports are inlined and it ships without the `/*! tailwindcss … */` banner. A stylesheet that uses Tailwind compiles exactly as before.
|
|
222
489
|
- 36408f1: The route JS budget report no longer counts, and the route build no longer emits, chunks for `"use client"` files that export only hooks, such as the `akanjs/store` field tools, which no page loads. Reported route sizes drop by about 21 KB brotli on every route of `apps/akan` and `apps/minimal`.
|
|
490
|
+
- 02cc5db: `akan quality runtime` reports, for each app and library, how many client files read the generated client runtime (`st`, `fetch`, `sig`, a cast to `RootStore`) only by names one module answers, and prints a note, `akan.runtime.whole-scope`, at each file that reads it by a computed key, through a cast, hands it on, re-exports it or imports it whole, so a page that loads that file loads the scope's whole client runtime. The notes never fail a command and change no build: the file works as it is. Each line also says how long reading the scope took. The report reads every name from module source, the store, signal and constant files of the scope and the libraries it loads, and a test checks those names against the ones the generated runtime answers.
|
|
223
491
|
- 98931e4: `akan start` boots the backend while the first base build runs: the backend loads its server graph beside the build and mounts the web surface as soon as the build's artifact is on disk, so the dev server is ready sooner.
|
|
224
492
|
|
|
225
493
|
The port now answers from the start of the build. A request to `localhost` or an IP address, page or API, waits for the first artifact; a build longer than the 15 s the gateway holds a request ends the wait with a 503 "Backend is starting" page that reloads itself. A request to one of the app's own domains (a custom local domain) gets that 503 at once until the backend is ready, because the build has not written the app's hosts yet; after that it is served as before, and any other Host is refused as before.
|
|
@@ -231,11 +499,29 @@
|
|
|
231
499
|
**Upgrading.** If `akan start` against a cluster environment opened its tunnel with neither setting, it now stops with that error in every database mode but `single`, where it logs the error and runs without Redis. Export `SSH_TUNNEL_PRIVATE_KEY_PATH` in the shell (a repository's dotenv file cannot set it), or set `SSH_TUNNEL_PASSWORD` to the password the cluster's tunnel endpoint expects. `SSH_TUNNEL_USERNAME` still defaults to `root`.
|
|
232
500
|
|
|
233
501
|
- 694444d: `akan verify` writes its build check to `dist/verify/<app>` and leaves `dist/apps/<app>` as `akan build` left it, so running `akan verify` after `akan build` no longer stops `cd dist/apps/<app> && bun main.js` from starting. The check no longer copies the app's `public/` and `private/` folders either.
|
|
502
|
+
- 86e2fe1: A workflow plan that lacks a required input now names the flag to pass and the inputs it was given but does not take.
|
|
503
|
+
|
|
504
|
+
`akan workflow plan create-scalar --app shop --module address` used to answer `requires input "scalar"` and drop `--module` without a word. It now answers `Workflow create-scalar requires input "scalar" (--scalar on the command line). It does not take "module", which was passed.` The `plan_workflow` tool of `akan mcp` returns the same message.
|
|
505
|
+
|
|
234
506
|
- Updated dependencies [4a568b2]
|
|
507
|
+
- Updated dependencies [e5d3cac]
|
|
235
508
|
- Updated dependencies [c44d068]
|
|
236
509
|
- Updated dependencies [43b44ca]
|
|
510
|
+
- Updated dependencies [af57986]
|
|
511
|
+
- Updated dependencies [f678e80]
|
|
237
512
|
- Updated dependencies [af09c4f]
|
|
238
513
|
- Updated dependencies [24315d1]
|
|
514
|
+
- Updated dependencies [7c4143e]
|
|
515
|
+
- Updated dependencies [e3f405f]
|
|
516
|
+
- Updated dependencies [55d1518]
|
|
517
|
+
- Updated dependencies [edf14fd]
|
|
518
|
+
- Updated dependencies [0a2f6dd]
|
|
519
|
+
- Updated dependencies [b5b4834]
|
|
520
|
+
- Updated dependencies [8720b88]
|
|
521
|
+
- Updated dependencies [4ff5d5e]
|
|
522
|
+
- Updated dependencies [b5b4834]
|
|
523
|
+
- Updated dependencies [a708a40]
|
|
524
|
+
- Updated dependencies [170fa28]
|
|
239
525
|
- Updated dependencies [19c6fa7]
|
|
240
526
|
- Updated dependencies [217b061]
|
|
241
527
|
- Updated dependencies [c7dee50]
|
|
@@ -248,15 +534,18 @@
|
|
|
248
534
|
- Updated dependencies [aff1ba2]
|
|
249
535
|
- Updated dependencies [bf582c1]
|
|
250
536
|
- Updated dependencies [8bbe7c8]
|
|
537
|
+
- Updated dependencies [2030f6c]
|
|
251
538
|
- Updated dependencies [90d740f]
|
|
252
539
|
- Updated dependencies [1a225e8]
|
|
253
540
|
- Updated dependencies [e9598f3]
|
|
254
541
|
- Updated dependencies [1885caf]
|
|
255
542
|
- Updated dependencies [45e3ffa]
|
|
256
543
|
- Updated dependencies [3032627]
|
|
544
|
+
- Updated dependencies [b6f1838]
|
|
257
545
|
- Updated dependencies [c10f7cf]
|
|
258
546
|
- Updated dependencies [c10f7cf]
|
|
259
547
|
- Updated dependencies [10641a0]
|
|
548
|
+
- Updated dependencies [234e31d]
|
|
260
549
|
- Updated dependencies [045699c]
|
|
261
550
|
- Updated dependencies [5c7e083]
|
|
262
551
|
- Updated dependencies [31097f2]
|
|
@@ -268,15 +557,20 @@
|
|
|
268
557
|
- Updated dependencies [4225827]
|
|
269
558
|
- Updated dependencies [4225827]
|
|
270
559
|
- Updated dependencies [fb5e77e]
|
|
560
|
+
- Updated dependencies [bfa67d8]
|
|
561
|
+
- Updated dependencies [6f8f6aa]
|
|
562
|
+
- Updated dependencies [ee302c4]
|
|
271
563
|
- Updated dependencies [31097f2]
|
|
272
564
|
- Updated dependencies [6e5da23]
|
|
273
565
|
- Updated dependencies [48d33a7]
|
|
274
566
|
- Updated dependencies [5c6d039]
|
|
567
|
+
- Updated dependencies [b30db27]
|
|
275
568
|
- Updated dependencies [0492e0b]
|
|
276
569
|
- Updated dependencies [0492e0b]
|
|
277
570
|
- Updated dependencies [5c7e083]
|
|
278
571
|
- Updated dependencies [98931e4]
|
|
279
572
|
- Updated dependencies [05ef91f]
|
|
573
|
+
- Updated dependencies [8720b88]
|
|
280
574
|
- Updated dependencies [f4b5aa6]
|
|
281
575
|
- Updated dependencies [4225827]
|
|
282
576
|
- Updated dependencies [8f9d432]
|
package/akanApp/akanApp.host.ts
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Logger } from "akanjs/common";
|
|
4
4
|
import type { BuilderMessage } from "akanjs/server";
|
|
5
|
+
import { AppBin } from "../app/appBin";
|
|
5
6
|
import type { App } from "../commandDecorators";
|
|
6
7
|
import { WorkspaceExecutor } from "../executors";
|
|
7
8
|
import type { DevStdioMode } from "../incrementalBuilder";
|
|
@@ -199,8 +200,18 @@ export class AkanAppHost {
|
|
|
199
200
|
}
|
|
200
201
|
if (!this.#backend.running) this.#backend.start();
|
|
201
202
|
this.#idle.arm();
|
|
203
|
+
void this.#warnMissingBin();
|
|
202
204
|
return this;
|
|
203
205
|
}
|
|
206
|
+
//? A bin two libs declare differently fails the build that carries it; a dev start has nothing to carry.
|
|
207
|
+
async #warnMissingBin() {
|
|
208
|
+
const names = await this.app
|
|
209
|
+
.getConfig()
|
|
210
|
+
.then((config) => new AppBin(this.app, config).names())
|
|
211
|
+
.catch(() => []);
|
|
212
|
+
const missing = AppBin.missing(names);
|
|
213
|
+
if (missing) this.logger.warn(missing);
|
|
214
|
+
}
|
|
204
215
|
async stop() {
|
|
205
216
|
//? Nothing reapplies once it stops: a pages ok received meanwhile would bring children back after it.
|
|
206
217
|
this.#stopping = true;
|
package/akanConfig/akanBin.ts
CHANGED
|
@@ -23,6 +23,10 @@ export class AkanBin {
|
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
static imagePath(binDir: string) {
|
|
27
|
+
return `/workspace/${binDir}/$TARGETARCH:$PATH`;
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
static isArchive(source: AkanBinSource): boolean {
|
|
27
31
|
return AkanBin.archive.test("url" in source ? new URL(source.url).pathname : source.path);
|
|
28
32
|
}
|
|
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
import { AppExecutor, WorkspaceExecutor } from "../executors";
|
|
7
7
|
import { NativeConfig } from "../mobile/nativeConfig";
|
|
8
8
|
import type { PackageJson } from "../workspace/types";
|
|
9
|
+
import { AkanBin } from "./akanBin";
|
|
9
10
|
import { AkanAppConfig, AkanLibConfig, deriveDefaultAppId } from "./akanConfig";
|
|
10
11
|
import { BUN_IMAGE_PIN, DEFAULT_DOCKER_IMAGE } from "./dockerImage";
|
|
11
12
|
import type { LibConfigInput } from "./types";
|
|
@@ -174,6 +175,16 @@ describe("AkanAppConfig", () => {
|
|
|
174
175
|
expect(unlocked).not.toContain("bun.lock");
|
|
175
176
|
});
|
|
176
177
|
|
|
178
|
+
test("a PATH the build hands in lands after the TARGETARCH it reads and the files it points at", () => {
|
|
179
|
+
const config = new AkanAppConfig(app, [], packageJson, {}, baseDevEnv);
|
|
180
|
+
const carrying = config.dockerfileFor("main", { env: { PATH: AkanBin.imagePath("bin") } });
|
|
181
|
+
|
|
182
|
+
expect(carrying).toContain("ENV PATH=/workspace/bin/$TARGETARCH:$PATH\n");
|
|
183
|
+
expect(carrying.indexOf("ARG TARGETARCH")).toBeLessThan(carrying.indexOf("ENV PATH="));
|
|
184
|
+
expect(carrying.indexOf("COPY . .")).toBeLessThan(carrying.indexOf("ENV PATH="));
|
|
185
|
+
expect(config.dockerfileFor("main")).not.toContain("ENV PATH=");
|
|
186
|
+
});
|
|
187
|
+
|
|
177
188
|
test.skipIf(process.platform === "win32")(
|
|
178
189
|
"writes a Dockerfile for a local build that refuses docker build without an explicit build arg",
|
|
179
190
|
() => {
|