Repo-wide Simplification Roadmap: ADR 0008 + ADR 0009
Overview
Two ADRs driving a comprehensive simplification of the LessJS codebase — preserving all functionality while eliminating coupling, duplication, and unnecessary abstraction layers.
ADR 0008 — Pipeline-level Restructuring
Eliminate createServer(), globalThis[Symbol.for()] bridges, .less/ temp file IPC, and runtime-shim.
Phases (execution order):
- Phase C+B (merge): Remove
createServer(), replace ssrLoadModule with import(), replace globalThis bridges with module variables
- Phase A: Replace
.less/ temp file IPC with define injection into SSR bundle
- Phase D: Delete
runtime-shim.ts + generate-runtime-shim.ts, replace less-runtime.ts with virtual:less-runtime
Key result: 3→2 Vite calls, 8+→0 temp files, 4→0 globalThis keys, SSR bundle actually consumed
Phase D detail — virtual:less-runtime:
Delete physical less-runtime.ts and the entire alias infrastructure (writeFileSync → userResolveAlias → resolve.alias). Replace with a virtual:less-runtime module implemented in the less() Vite plugin's resolveId/load hooks. Consumers keep the same import path (@lessjs/core/less-runtime), zero code changes needed. Also removes export { Hono } from 'hono' — consumers import Hono directly.
ADR 0009 — Repo-wide Simplification (on top of ADR 0008)
Layered simplification across @lessjs/core and cross-package boundaries.
Layer 1 — Core internal simplification (6 independent + 2 dependent items):
Layer 2 — Cross-package decoupling:
Layer 3 — Export cleanup & file deletion:
Execution Order
Phase C+B (ADR 0008)
→ Layer 1.1–1.6, 1.8 (all independent, can parallel)
→ Layer 1.7, 1.9 (depend on C+B)
→ less-runtime.ts → virtual:less-runtime + adapter-registry.ts extraction
Phase A → D (ADR 0008)
→ Layer 2 remaining
→ Layer 3 export audit
Expected Impact
- ~350 lines reduced in core (5846 → ~5495)
- 5 files deleted:
hono-entry.ts, ssr-handler.ts, less-runtime.ts, runtime-shim.ts, generate-runtime-shim.ts
- 2 files created:
ssr-helper.ts, adapter-registry.ts (clear single-responsibility modules)
- 1 virtual module added:
virtual:less-runtime (replaces physical file + 35 lines of alias logic, zero consumer changes)
- Zero functionality changes — all simplifications are behavior-preserving
Full details: docs/decisions/0008-eliminate-createserver-globalthis-bridges.md and ADR 0009 artifact
Repo-wide Simplification Roadmap: ADR 0008 + ADR 0009
Overview
Two ADRs driving a comprehensive simplification of the LessJS codebase — preserving all functionality while eliminating coupling, duplication, and unnecessary abstraction layers.
ADR 0008 — Pipeline-level Restructuring
Eliminate
createServer(),globalThis[Symbol.for()]bridges,.less/temp file IPC, andruntime-shim.Phases (execution order):
createServer(), replacessrLoadModulewithimport(), replaceglobalThisbridges with module variables.less/temp file IPC withdefineinjection into SSR bundleruntime-shim.ts+generate-runtime-shim.ts, replaceless-runtime.tswithvirtual:less-runtimeKey result: 3→2 Vite calls, 8+→0 temp files, 4→0 globalThis keys, SSR bundle actually consumed
Phase D detail —
virtual:less-runtime:Delete physical
less-runtime.tsand the entire alias infrastructure (writeFileSync→userResolveAlias→resolve.alias). Replace with avirtual:less-runtimemodule implemented in theless()Vite plugin'sresolveId/loadhooks. Consumers keep the same import path (@lessjs/core/less-runtime), zero code changes needed. Also removesexport { Hono } from 'hono'— consumers importHonodirectly.ADR 0009 — Repo-wide Simplification (on top of ADR 0008)
Layered simplification across
@lessjs/coreand cross-package boundaries.Layer 1 — Core internal simplification (6 independent + 2 dependent items):
CodeBuilderclass →string[]hono-entry.tsintoentry-renderer.tsescapeHtml()renderPageRoutewrapInDocument branchesrenderCorsOriginduplicate branchesssr-handler.tsintohtml-escape.ts__ssrtossr-helper.ts(needs Phase C+B)__less_get_default_exporthelperLessBuildContext.userResolveAlias(needs Phase C)Layer 2 — Cross-package decoupling:
render-dsd.tsre-exports ofhtml-escapeas@deprecatedruntime-shim.ts(ADR 0008 Phase D)blog-data.tswithi18n-data.tspattern (ADR 0008 Phase B)walkHtmlFiles()fromssg-postprocess.ts(eliminate 5× duplication)Layer 3 — Export cleanup & file deletion:
render-dsd.tsre-export chain cleanupless-runtime.ts→ replace withvirtual:less-runtimein Vite plugin (needs Phase C+B, zero consumer changes)index.tsexport audit (mark CLI internals as@internal)registerAdapter/getAdaptertoadapter-registry.tsExecution Order
Expected Impact
hono-entry.ts,ssr-handler.ts,less-runtime.ts,runtime-shim.ts,generate-runtime-shim.tsssr-helper.ts,adapter-registry.ts(clear single-responsibility modules)virtual:less-runtime(replaces physical file + 35 lines of alias logic, zero consumer changes)Full details:
docs/decisions/0008-eliminate-createserver-globalthis-bridges.mdand ADR 0009 artifact