Skip to content

feat(ecs): merge imports plugins at runtime (types still exclude them)#119

Merged
krisnye merged 1 commit into
mainfrom
krisnye/plugin-imports-runtime-merge
Jun 8, 2026
Merged

feat(ecs): merge imports plugins at runtime (types still exclude them)#119
krisnye merged 1 commit into
mainfrom
krisnye/plugin-imports-runtime-merge

Conversation

@krisnye

@krisnye krisnye commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #118. imports was previously type-only — the imported plugins' members were visible to local declarations but contributed nothing at runtime. That meant a consumer who forgot to re-list an imported plugin in the top-level combine(...) got undefined transactions/resources at runtime despite a clean compile.

This makes imports merge into the assembled plugin at runtime exactly like extends (order: imports → extends → local declarations, preserving service initialization order).

This is a pure runtime change — no type changes

The result type is unchanged and still excludes the imported members. That's the whole point: it preserves the property that kills the quadratic extends blowup (imported members do not propagate through downstream result types). The public function signature is identical; only the function body changed.

So:

result type runtime plugin
extends includes base includes base
imports (before) excludes excluded ← footgun
imports (now) excludes includes

Verification

  • tsc -b green; 62 plugin tests pass (added an "imports runtime behavior" suite proving imported members exist on the assembled plugin and on a database built from it alone, with no separate combine); lint clean.
  • The existing imports-chain.type-test.ts still passes unchanged — imported members remain absent from the result type.
  • Also fixes doc comments that incorrectly told consumers they must re-list imports, and removes a stray artifact in the typeperf README.

Bump to 0.9.65.

🤖 Generated with Claude Code

Previously `imports` was type-only: the imported plugins' members were visible
to local declarations but contributed nothing at runtime, so a consumer that
forgot to re-list them in the top-level combine got `undefined` transactions/
resources at runtime despite a clean compile.

Now `imports` merges into the assembled plugin at runtime exactly like
`extends` (order: imports, then extends, then local — preserving service init
order). This is a pure runtime change: the result TYPE is unchanged and still
excludes the imported members, so the quadratic-killing property is preserved
(imports do not propagate through downstream result types). No type-signature
changes.

Adds "imports runtime behavior" tests proving imported members exist on the
assembled plugin and on a database built from it alone (no separate combine).
Updates docs that incorrectly stated the consumer must re-list imports.

Bump to 0.9.65.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@krisnye krisnye merged commit 070d8b8 into main Jun 8, 2026
3 checks passed
@krisnye krisnye deleted the krisnye/plugin-imports-runtime-merge branch June 8, 2026 18:54
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