Skip to content

Commit 029a3b2

Browse files
krisnyeclaude
andauthored
feat(ecs): add imports to Database.Plugin.create — consume types without re-export (#118)
* test(ecs): add plugin-composition type-complexity benchmark harness Adds scripts/typeperf/ — a reproducible ruler for how Database.Plugin composition scales the TypeScript type-checker. Generates synthetic extends/imports chains at depths [2..32], type-checks each in isolation with `tsc --extendedDiagnostics`, and reports Types / Instantiations / Check time vs depth. Baseline finding (TS 5.8.3): `extends` Instantiations grow ~quadratically with chain depth (121K@2 -> 3.38M@32; inst/depth^2 flat ~2-3K), while Types grow only linearly — i.e. the cost is repeated re-instantiation of the full accumulated 9-bucket intersection, not distinct types. This is the ruler we'll use to measure the additive `imports` property. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * feat(ecs): add `imports` to Database.Plugin.create — consume types without re-export `extends` re-exports all of a base plugin's types into the result, so a deep chain accumulates the full 9-bucket intersection at every link — type-checker Instantiations grow ~quadratically with depth (3.4M at depth 32) and deep chains hit TS7056, forcing `db: any`. `imports` is the additive complement: the imported plugins' types are visible to local declarations (full type safety on their components / resources / transactions — verified by imports-chain.type-test.ts, including @ts-expect-error negative guards) but are NOT re-exported into the result type. Each link's result stays O(local members), so the chain is linear; consumers reconstitute the union once at the top via Database.Plugin.combine(...). Measured via scripts/typeperf (TS 5.8.3): at depth 32 imports is 8.8x fewer Instantiations (387K vs 3.41M) with a flat per-link marginal vs extends' super-linear climb. `extends` is untouched: its result type still references XP alone, and the new `& IP['x']` terms reduce to `& {}` when imports is unused (within ~1% of baseline), so existing plugins pay nothing and no pre-existing type check is weakened (full tsc -b + 226 ECS tests green). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * chore: bump to 0.9.64; ignore typeperf generated output in eslint Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * refactor(ecs): require `imports` before `extends` in plugin descriptor order Reorders the descriptor property contract so dependency declarations (`imports`) precede the re-exporting base (`extends`). Updates validatePropertyOrder, the descriptor type field order, and the doc comment; adds a regression test asserting `imports` must come before `extends`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 20f2917 commit 029a3b2

21 files changed

Lines changed: 496 additions & 67 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-monorepo",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"private": true,
55
"scripts": {
66
"build": "pnpm -r run build",

packages/data-lit-tictactoe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-lit-tictactoe",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Tic-Tac-Toe sample - Lit web components with @adobe/data-lit and AgenticService",
55
"type": "module",
66
"private": true,

packages/data-lit-todo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-lit-todo",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Todo sample app demonstrating @adobe/data with Lit",
55
"type": "module",
66
"private": true,

packages/data-lit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-lit",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Adobe data Lit bindings - hooks, elements, decorators",
55
"type": "module",
66
"private": false,

packages/data-p2p-tictactoe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-p2p-tictactoe",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Serverless P2P tic-tac-toe — WebRTC DataChannel + @adobe/data-sync",
55
"type": "module",
66
"private": true,

packages/data-persistence/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-persistence",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Worker-based incremental persistence layer for @adobe/data ECS over OPFS (browser) and node:fs (server).",
55
"type": "module",
66
"sideEffects": false,

packages/data-react-hello/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-react-hello",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Hello World sample - click counter using @adobe/data-react",
55
"type": "module",
66
"private": true,

packages/data-react-pixie/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-react-pixie",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "PixiJS React sample - ECS sprites (bunny, fox) with @adobe/data-react",
55
"type": "module",
66
"private": true,

packages/data-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-react",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Adobe data React bindings — hooks and context for ECS database",
55
"type": "module",
66
"private": false,

packages/data-solid-dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-solid-dashboard",
3-
"version": "0.9.63",
3+
"version": "0.9.64",
44
"description": "Mini dashboard sample — multiple components sharing one @adobe/data ECS database with SolidJS",
55
"type": "module",
66
"private": true,

0 commit comments

Comments
 (0)