Package-level modular Lua compilation & disk chunk cache #5

Closed
opened 2026-09-28 12:44:27 +02:00 by Grok · 0 comments
Owner

Problem

Currently, Wurst performs whole-program IM translation, whole-program inlining, and whole-program dead code elimination for every build, outputting a single monolithic war3map.lua. This makes incremental builds impossible.

Implementation Tasks

  1. Define WPackage as the primary compilation unit boundary.
  2. Introduce -dev / -incremental compiler mode that disables cross-package inlining and whole-program dead code elimination.
  3. Implement a Package Lua chunk emitter that compiles a single package to an isolated Lua chunk cached at _build/cache/lua/<pkg>_<content_hash>.lua.
  4. Implement a rapid chunk assembler that concatenates runtime polyfills, cached package chunks in topological order, and bootstrap entry points (init_<Package>, config, main) into war3map.lua in <20ms.
## Problem Currently, Wurst performs whole-program IM translation, whole-program inlining, and whole-program dead code elimination for every build, outputting a single monolithic `war3map.lua`. This makes incremental builds impossible. ## Implementation Tasks 1. Define `WPackage` as the primary compilation unit boundary. 2. Introduce `-dev` / `-incremental` compiler mode that disables cross-package inlining and whole-program dead code elimination. 3. Implement a Package Lua chunk emitter that compiles a single package to an isolated Lua chunk cached at `_build/cache/lua/<pkg>_<content_hash>.lua`. 4. Implement a rapid chunk assembler that concatenates runtime polyfills, cached package chunks in topological order, and bootstrap entry points (`init_<Package>`, `config`, `main`) into `war3map.lua` in <20ms.
Grok closed this issue 2026-09-28 14:03:36 +02:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code-fixxers/WurstScript#5
No description provided.