Skip to content

feat(ts): add TypeScript tableau loader generator (protoc-gen-ts-tableau-loader)#165

Open
Kybxd wants to merge 7 commits into
masterfrom
ts-loader
Open

feat(ts): add TypeScript tableau loader generator (protoc-gen-ts-tableau-loader)#165
Kybxd wants to merge 7 commits into
masterfrom
ts-loader

Conversation

@Kybxd

@Kybxd Kybxd commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a TypeScript tableau loader code generator, protoc-gen-ts-tableau-loader,
bringing TS to parity with the existing Go / C# / C++ loaders. Built on
protobuf-es (@bufbuild/protobuf v2),
it generates strongly-typed loaders from the same proto definitions.

Why

The repo already ships Go/C#/C++ loaders but had no first-class TypeScript
target. This lets TS/Node consumers load the same tableau-generated configs
with typed accessors and identical patch semantics.

Changes

Generator — cmd/protoc-gen-ts-tableau-loader

  • Plugin entrypoints: main.go, messager.go, hub.go, plus helper/ for
    name/type mapping.
  • Embedded runtime (embed/): load.pc.ts, messager.pc.ts, util.pc.ts,
    and the hub.pc.ts.tpl template.
  • Features: typed multi-level map getters, Hub with name filter, JSON/BIN
    formats, and patch loading — PATCH_MERGE / PATCH_REPLACE, with
    LoadMode.ALL / ONLY_MAIN / ONLY_PATCH.
  • Exposes the new TS option in internal/options.

Test harness — test/ts-tableau-loader

  • buf.gen.yaml, tsconfig.json, package manifests, and generated loaders.
  • tests/smoke.ts (12 checks): hub load, int/string-keyed and nested map
    getters, filter, BIN load, patch MERGE golden compare vs patchresult/,
    PATCH_REPLACE full-replace, ONLY_MAIN / ONLY_PATCH, and BIN load failure.

Toolchain & CI

  • devcontainer + make.py now install Node via NodeSource (apt/dnf) and
    brew node@; versions.env pins NODE_VERSION (major).
  • New GitHub workflows: testing-ts.yml, release-ts.yml.
  • Updated test_make.py, README.md, CLAUDE.md.

Testing

  • python3 -m pytest test_make.py — 117 passed.
  • npx tsc --noEmit — clean.
  • npx tsx tests/smoke.ts — all 12 smoke checks pass.

Notes / Follow-ups

Not yet generated for TS (deferred, larger feature work): OrderedMap iteration,
Store/write-back, Context (NewContext/FromContext), custom post-load processors,
and typed-vs-generic accessor identity. These are tracked as gaps vs Go/C#.

Kybxd added 7 commits June 17, 2026 17:58
Introduce a TypeScript tableau loader generator (protobuf-es backed), mirroring the existing Go/C#/C++ loaders, together with its test harness and the toolchain/CI plumbing needed to build and test it.

Generator (cmd/protoc-gen-ts-tableau-loader): main/messager/hub plugin entrypoints and the embedded runtime (load/messager/util .pc.ts + hub template); typed map getters, Hub with name filter, JSON/BIN formats and patch loading (MERGE/REPLACE, LoadMode ALL/ONLY_MAIN/ONLY_PATCH); helper package for naming/type mapping; expose the TS option in internal/options.

Test harness (test/ts-tableau-loader): buf.gen + tsconfig + package manifests and generated loaders; smoke.ts covering hub load, nested map getters, string/int keys, filter, BIN load, patch MERGE/REPLACE golden compare, ONLY_MAIN/ONLY_PATCH modes and BIN load failure.

Toolchain & CI: devcontainer + make.py install Node via NodeSource (apt/dnf) and brew node@, pin NODE_VERSION (major) in versions.env; add testing-ts/release-ts GitHub workflows; update test_make.py, README and CLAUDE.md accordingly.
- testing-ts: narrow node-version matrix to the pinned LTS (20) only.

- test_make: normalize Windows npm.cmd shim to npm in TS dry-run asserts.

- remove the _lab/ts proof-of-concept and its .gitignore entry.
…th shared harness

Reorganize the TS test suite into per-feature files (load/get/ordered_map/index) backed by a shared harness, and refresh the protoc-gen-ts-tableau-loader generator and generated tableau sources accordingly.
- ts: move custom_item_conf.ts out of tests/ into a dedicated custom/ dir (matches C# custom/, Go customconf/), update tsconfig include and import path

- csharp: drop TaskConf filter from shared HubFixture so it is a full load equivalent to Go/C++/TS; cover HubOptions.Filter via an isolated Hub_Filter_LoadsOnlyMatchingMessagers test
…dedup across loaders

- add internal/genhelper with shared file-header (ProtocVersion/header) and map-key (MapKey/MapKeySlice) helpers

- replace per-loader duplicated helper code (cpp/csharp/go/ts) by reusing the shared genhelper package

- ts: extract barrel logic into barrel.go; add reserved-keyword handling (helper/keyword.go)

- csharp: drop unused gen/messagerName params from genMessage/genMapGetters/generateFileContent

- remove obsolete cmd/protoc-gen-go-tableau-loader/helper.go
…oss loaders

Define a single generic genhelper.MapKeySlice[F ParamFormatter] carrying all
shared methods (AddMapKey/GenGetParams/GenGetArguments/GenCustom/
GenOtherArguments). Each loader only provides a zero-size ParamFormatter and
aliases the slice, removing duplicated per-language definitions. The TS loader
drops its MapKey wrapper/NeedToString field (derived from Type via IndexExpr)
to reuse the same generic. Inline the former global helpers as MapKeySlice[F]
methods. Generated output is byte-for-byte unchanged.
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