Skip to content

js: embed the whole library source in Sources - #131

Merged
paralin merged 1 commit into
masterfrom
js-sources
Nov 15, 2026
Merged

paralin merged 1 commit into
masterfrom
js-sources

Conversation

@paralin

@paralin paralin commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Sources held only the three modules that import nothing, so a Go module that vendors Modlock kept the HUD tokens, the hero table and the text helpers but not the library itself. Embedding all of js/src gives a vendoring module the TypeScript library at the version it pins: its type checker can resolve modlock to the vendored src/index.ts, with no npm package or project setup step. The protobuf messages the source imports are already vendored with their own packages.

A new test checks that Sources holds the entry module and every module its source imports from inside src.

Measured size: the vendored tree grows by 2,576,353 bytes in 34 files (from 3 files and 17,279 bytes to 37 files and 2,593,632 bytes), most of it entities.ts at 1,796,099 bytes. Nothing in Modlock reads Sources, so no binary grows.

Sources held only the three modules that import nothing, so a Go module
that vendors Modlock kept the HUD tokens, the hero table and the text
helpers but not the library itself. Embedding all of src gives a vendoring
module the TypeScript library at the version it pins: its type checker can
resolve modlock to the vendored src/index.ts, with no npm package or
project setup step. The protobuf messages the source imports are already
vendored with their own packages.

A test checks that Sources holds the entry module and every module its
source imports from inside src.

The vendored tree grows by 2,576,353 bytes in 34 files, most of it
entities.ts. Nothing in Modlock reads Sources, so no binary grows.

Signed-off-by: Christian Stewart <christian@aperture.us>
@paralin
paralin merged commit c513f19 into master Nov 15, 2026
7 checks passed
@paralin
paralin deleted the js-sources branch November 15, 2026 14:00
paralin added a commit that referenced this pull request Nov 15, 2026
Signed-off-by: Christian Stewart <christian@aperture.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant