packages/ flattens into: backends/ server protocol adapters (mizan-django, mizan-ts) frontends/ client kernel + framework adapters (mizan-base, mizan-react, mizan-vue, mizan-svelte) workers/ runtime workers (mizan-ssr) cores/ shared language-level primitives (empty for now; mizan-python forthcoming) The frontend kernel (was packages/mizan-runtime, now frontends/mizan-base) is renamed to reflect its role — it's the shared base that frontend adapters depend on directly. Reflects the substrate position that per-framework adapters wrap a single shared kernel; codegen targets the adapter, not the raw kernel. Path updates landed in: Makefile, two Gitea workflows, Dockerfile.test, four example/harness config files, .claude/settings.local.json, four docs (CLAUDE/ISSUES/ROADMAP/AFI_ARCHITECTURE), four codegen templates (stage1 + react/vue/svelte adapters), and three package.jsons (the mizan-base rename plus mizan-vue/svelte peerDeps). Generated files under examples/django-react-site/harness/src/api/ still reference @mizan/runtime — left as-is; they're regenerated artifacts and the harness is non-functional pending the React wrapper-layer codegen. Also folded in a pre-existing fix: the Gitea workflows had working-directory: react / django pointing at a layout that predates packages/, never updated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
45 lines
1003 B
TypeScript
45 lines
1003 B
TypeScript
/**
|
|
* Cache backends — MemoryCache for testing.
|
|
*
|
|
* Simple key-value store. No reverse indexes.
|
|
*/
|
|
|
|
export interface CacheBackend {
|
|
get(key: string): string | null
|
|
set(key: string, value: string): void
|
|
delete(key: string): boolean
|
|
deleteByPrefix(prefix: string): number
|
|
clear(): void
|
|
}
|
|
|
|
export class MemoryCache implements CacheBackend {
|
|
private _store = new Map<string, string>()
|
|
|
|
get(key: string): string | null {
|
|
return this._store.get(key) ?? null
|
|
}
|
|
|
|
set(key: string, value: string): void {
|
|
this._store.set(key, value)
|
|
}
|
|
|
|
delete(key: string): boolean {
|
|
return this._store.delete(key)
|
|
}
|
|
|
|
deleteByPrefix(prefix: string): number {
|
|
let count = 0
|
|
for (const key of [...this._store.keys()]) {
|
|
if (key.startsWith(prefix)) {
|
|
this._store.delete(key)
|
|
count++
|
|
}
|
|
}
|
|
return count
|
|
}
|
|
|
|
clear(): void {
|
|
this._store.clear()
|
|
}
|
|
}
|