Skip to content

Commit f7aff02

Browse files
committed
v2
1 parent 9fe0552 commit f7aff02

557 files changed

Lines changed: 9624 additions & 17304 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/www/src/app/dev/editor-perf/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,8 +6522,7 @@ export default function EditorPerfPage() {
65226522
<p className="mt-2 text-muted-foreground text-sm">
65236523
This lane times real <code>insertFragment</code> work against raw
65246524
import data and duplicate-id paste data. That is the only honest
6525-
way to see whether <code>withNodeId</code> still has money on the
6526-
table.
6525+
way to see whether NodeId normalization still has money on the table.
65276526
</p>
65286527

65296528
<div className="mt-4 grid gap-4 xl:grid-cols-2">

docs/plans/2026-06-23-cut-plite-editor-namespace-imports.md

Lines changed: 344 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# plate core api law hard cut
2+
3+
Objective:
4+
Cut Plate core legacy runtime API; done when core and one representative package use Plite update/api law and gates pass.
5+
6+
Automation source:
7+
- User-invoked `auto` lane.
8+
- Prompt: finalize core API law; delete runtime compat bridge; make Plite runtime the default core route; cut `runtime` param; split `createPlateRuntimeEditor.ts` only after compat sludge is gone; then sweep packages.
9+
- Lane: Plate core runtime/API.
10+
- Timebox: none.
11+
12+
First checkpoint:
13+
- Explicit prompt requirements were copied here before implementation.
14+
- Checkpoints are mutable: update them as evidence changes.
15+
16+
Completion threshold:
17+
- Complete this checkpoint when core no longer exposes the legacy transform surfaces, the Plite runtime is the default core route, `createPlateRuntimeEditor.ts` has at least one durable post-cut split, one representative package is migrated and green, banned API audits are clean, and the plan records remaining broad-sweep debt before pausing for review.
18+
19+
Verification surface:
20+
- Source audits for banned legacy API strings and runtime selector support.
21+
- Core/list typecheck, build, lint, focused core runtime tests, and full `@platejs/list` package tests.
22+
- Plan evidence updated with exact commands and remaining risks.
23+
24+
Constraints:
25+
- No public compat aliases or runtime shims.
26+
- Keep `extendTx` and `extendTxGroup`.
27+
- Do not split the runtime monolith before deleting compat sludge.
28+
- Pause after core plus one representative package are clean; do not start the broad package sweep before review.
29+
30+
Boundaries:
31+
- This checkpoint covers core runtime/API law and one representative package migration.
32+
- Link/math package failures are recorded as future package lanes, not solved inside this checkpoint.
33+
- Full Plate v2 package sweep and release claims are outside this checkpoint.
34+
35+
Blocked condition:
36+
- Blocked only if the core/list gates cannot pass without reintroducing a banned compat surface or changing the approved API law.
37+
38+
Work Checklist:
39+
- [x] Copy explicit requirements into the plan before implementation.
40+
- [x] Remove legacy public transform surfaces from core.
41+
- [x] Make Plite runtime the default core route and cut runtime selector support.
42+
- [x] Split durable runtime owners after compat cleanup.
43+
- [x] Migrate and prove one representative package.
44+
- [x] Run source audits and focused gates.
45+
- [x] Record remaining broad-sweep debt and pause before continuing.
46+
47+
Phase / pass table:
48+
| Phase | Status | Evidence |
49+
|-------|--------|----------|
50+
| Core API hard cut | done | Banned API and legacy bridge audits return no matches. |
51+
| Runtime default route | done | Runtime selector audit returns no legacy runtime route. |
52+
| Runtime split | done | Parser, NodeId, and input-rule owners extracted. |
53+
| Representative package | done | `@platejs/list` passes full package tests. |
54+
| Broad package sweep | paused | Link/math dirty lanes recorded for later package-by-package work. |
55+
56+
Verification evidence:
57+
- `pnpm turbo typecheck --filter=./packages/core --filter=./packages/list` passed after final edits.
58+
- `pnpm --filter @platejs/core --filter @platejs/list build` passed after final edits.
59+
- `pnpm --filter @platejs/core --filter @platejs/list lint:fix` passed after final edits.
60+
- `bun test src/react/editor/createPlateRuntimeEditor.spec.ts src/lib/plugins/input-rules/createTextSubstitutionInputRule.spec.ts src/react/utils/inputRules.spec.tsx src/lib/plugins/ParserPlugin.spec.ts src/lib/plugins/node-id/NodeIdPlugin.spec.tsx` passed with 134 tests.
61+
- `pnpm --filter @platejs/list test` passed with 104 tests.
62+
- Final banned API and legacy bridge audits returned no matches.
63+
64+
Reboot status:
65+
- Current checkpoint is review-ready: core plus `@platejs/list` are green. Resume with link/math package lanes or another runtime-file split only after review.
66+
67+
Open risks:
68+
- Full core package test still needs harness cleanup because focused proof is green but the full command was previously too slow/noisy.
69+
- `@platejs/link` and `@platejs/math` have package-specific dirty lanes still outside this checkpoint.
70+
- `createPlateRuntimeEditor.ts` is still large after the first split.
71+
72+
Core API law:
73+
- `editor.api.*` is for reads, services, and plugin APIs.
74+
- `editor.update(tx => tx.*)` is for mutations and commands.
75+
- `extendTx` and `extendTxGroup` stay.
76+
- `extendTransforms`, `editor.tf`, `getTransforms`, and `getPluginApi` die.
77+
- Public compat aliases and runtime shims are not allowed.
78+
- Private bridges are allowed only as deletion scaffolds with a named owner and proof gate.
79+
80+
Status:
81+
- Public API hard cut: complete.
82+
- Runtime compat bridge deletion: complete for the requested public/private bridge surfaces.
83+
- Core tests migrated off `editor.tf`: complete for touched/focused core rows.
84+
- First representative package migration: complete (`@platejs/list` is green on the Plite route; `@platejs/code-block` and `@platejs/selection` were also proved individually; table and utils were also proved).
85+
- Broad banned-API package sweep: complete for the current banned patterns.
86+
- `createPlateRuntimeEditor.ts` split: in progress. Parser, NodeId, and input-rule runtime owners were extracted; the file is still large enough that one more cleanup packet is warranted.
87+
- Final closure: not complete until the remaining large-file split/review gate, link/math dirty-lane decisions, and autoreview are done.
88+
89+
Requirement ledger:
90+
| Requirement | Status | Evidence |
91+
|-------------|--------|----------|
92+
| `editor.api.*` reads/services/plugin APIs | done | Runtime API surface kept; copy serialization moved to `editor.api.setFragmentData`; composing exposed through API. |
93+
| `editor.update(tx => tx.*)` mutations/commands | done | Core and package callers migrated from `editor.tf` / `api.create.*` to `editor.update` or literal nodes. |
94+
| Keep `extendTx` / `extendTxGroup` | done | Tx extension path preserved through `runtimeTxExtensions.ts`. |
95+
| Kill `extendTransforms`, `editor.tf`, `getTransforms`, `getPluginApi` | done | Final banned API audit returned no matches in package source/tests. |
96+
| Delete runtime compat bridge | done | Deleted legacy update bridge; current runtime bridge no longer exposes public `tf`; transform override plumbing removed from touched owners. |
97+
| Make Plite runtime default | done | `runtime` selector audit is clean for core editor route. |
98+
| Cut `runtime` param | done | No supported `runtime` option remains in scoped core editor route audit. |
99+
| Split `createPlateRuntimeEditor.ts` after cleanup | partial | Extracted `runtimeParser.ts`, `runtimeNodeId.ts`, and `runtimeInputRules.ts`; monolith is currently 9,886 lines after adding runtime list sequence law. |
100+
| Package sweep | done for banned API hits | All current banned API package hits were patched and proved where touched. |
101+
102+
Changed list:
103+
| Area | Changes |
104+
|------|---------|
105+
| Core runtime bridge | Deleted `legacyRuntimeUpdateBridge.ts`; added `runtimeTxExtensions.ts`; removed public `editor.tf` descriptor/fallback; renamed current runtime transform install surface; removed transform override merge path. |
106+
| Core editor route | `createPlateRuntimeEditor.ts` no longer installs transform facade compatibility; API surface renamed from compat to runtime; host clipboard insertion goes through `editor.update`; normalize remove-vs-merge behavior fixed. |
107+
| Core plugins/tests | Migrated input rules, length, static, parser, fragment insertion, normalize initial value, override editor, Plite React extension, omit context, render props, and Plate slow tests off old transform/create APIs. |
108+
| Runtime defaults | Added base length extension in `withPlite`; runtime length reads plugin options through current API shape. |
109+
| Runtime split | Extracted parser, NodeId, and input-rule runtime feature owners from `createPlateRuntimeEditor.ts`. |
110+
| Package callers | Patched `code-block`, `selection`, `markdown`, `list-classic`, `ai`, `table`, and `utils` banned API callers. |
111+
| List runtime proof | Migrated list input-rule/toggle-list proof to the Plite runtime; `toggleList` filters expanded selections to block element entries; runtime list normalization now honors `getSiblingListOptions`, nested siblings, heading boundaries, and page-wrapper sibling providers. |
112+
| Representative packages | `code-block` and `selection` proved with package tests; table and utils were proved earlier in the same lane. |
113+
114+
Proof:
115+
| Command | Result |
116+
|---------|--------|
117+
| `pnpm turbo typecheck --filter=./packages/core` | pass |
118+
| `pnpm --filter @platejs/core build` | pass |
119+
| focused core suite covering runtime/plugin/store/API rows | 190 pass, 0 fail |
120+
| `pnpm turbo typecheck --filter=./packages/core --filter=./packages/code-block --filter=./packages/list-classic --filter=./packages/markdown --filter=./packages/selection --filter=./packages/ai` | pass |
121+
| `pnpm --filter @platejs/core --filter @platejs/code-block --filter @platejs/list-classic --filter @platejs/markdown --filter @platejs/selection --filter @platejs/ai lint:fix` | pass |
122+
| `pnpm --filter @platejs/core --filter @platejs/code-block --filter @platejs/list-classic --filter @platejs/markdown --filter @platejs/selection --filter @platejs/ai build` | pass |
123+
| `pnpm --filter @platejs/code-block test` | 79 pass, 0 fail |
124+
| `pnpm --filter @platejs/selection test` | 102 pass, 0 fail |
125+
| grouped package tests for markdown/list-classic/ai | markdown 234 pass; list-classic 105 pass; ai 64 pass |
126+
| `pnpm turbo typecheck --filter=./packages/table` | pass |
127+
| `pnpm --filter @platejs/table test` | 218 pass, 0 fail |
128+
| `pnpm --filter @platejs/table build` | pass |
129+
| `pnpm turbo typecheck --filter=./packages/utils` | pass |
130+
| `bun test src/lib/plugins/ExitBreakPlugin.spec.ts` in `packages/utils` | 3 pass, 0 fail |
131+
| `bun test src/lib/plugins/ParserPlugin.spec.ts src/lib/plugins/node-id/NodeIdPlugin.spec.tsx src/react/editor/createPlateRuntimeEditor.spec.ts` | 116 pass, 0 fail |
132+
| `bun test src/lib/plugins/input-rules/createTextSubstitutionInputRule.spec.ts src/react/utils/inputRules.spec.tsx src/react/editor/createPlateRuntimeEditor.spec.ts` | 118 pass, 0 fail |
133+
| `bun test src/react/editor/createPlateRuntimeEditor.spec.ts src/lib/plugins/input-rules/createTextSubstitutionInputRule.spec.ts src/react/utils/inputRules.spec.tsx src/lib/plugins/ParserPlugin.spec.ts src/lib/plugins/node-id/NodeIdPlugin.spec.tsx` | 134 pass, 0 fail |
134+
| `bun test src/lib/inputRules.spec.tsx` in `packages/list` | 3 pass, 0 fail |
135+
| `pnpm turbo typecheck --filter=./packages/core --filter=./packages/list` | pass |
136+
| `pnpm --filter @platejs/core --filter @platejs/list lint:fix` | pass |
137+
| `pnpm --filter @platejs/list build` | pass |
138+
| `pnpm --filter @platejs/list test` | 104 pass, 0 fail |
139+
| `pnpm --filter @platejs/core --filter @platejs/list build` | pass |
140+
141+
Final audits:
142+
| Audit | Result |
143+
|-------|--------|
144+
| `rg -n "api\\.create\\.block|editor\\.api\\.create\\.block|create\\.value\\(|create\\.block\\(|editor\\.tf|\\btf\\s*:|getPluginApi|getTransforms|extendTransforms|combinePlateMatchOptions" packages --glob '*.{ts,tsx}'` | no matches |
145+
| `rg -n "legacyRuntimeUpdateBridge|installLegacyRuntimeUpdateBridge|CurrentRuntimeTransformHost|installCurrentRuntimeTransformFacade|Object\\.defineProperty\\(editor as object, 'tf'|Object\\.getOwnPropertyDescriptor\\(editor as object, 'tf'" packages/core/src packages --glob '*.{ts,tsx}'` | no matches |
146+
| runtime selector audit under core editor/lib/react | no supported `runtime` option remains |
147+
148+
Workflow slowdowns:
149+
| Slowdown | Impact | Decision |
150+
|----------|--------|----------|
151+
| `pnpm --filter @platejs/core test` hung/silent around 90s twice | Full core package test was not usable as a checkpoint proof. | Use focused core tests for this packet; make full package test harness a separate cleanup lane if it keeps hanging. |
152+
| Grouped package test interrupted because core hung | Could not claim one combined all-package test command. | Individual and grouped non-core package proof is enough for this API sweep. |
153+
| `@platejs/link` full package test | Expanded `upsertLink` helper tests fail in the broader package run. | Separate package migration lane; not caused by runtime parser/input-rule extraction. |
154+
| `@platejs/math` full package test | One equation deleteBackward regression remains; math input-rule rows pass. | Separate package migration lane. |
155+
156+
Needs your attention:
157+
| Rank | Item | Why | Recommendation |
158+
|------|------|-----|----------------|
159+
| 1 | `createPlateRuntimeEditor.ts` remaining split | Parser/NodeId/input-rules are out, but the file is still 9,886 lines. | Extract another durable owner only after this API-law review point is accepted. |
160+
| 2 | Full core test harness hang | Focused proof is green, but the full package command is poor feedback. | Fix or split the core test lane before release-grade closure. |
161+
| 3 | Link/math dirty tests | `@platejs/link` expanded `upsertLink` and `@platejs/math` equation deleteBackward have existing package failures. | Queue as package-by-package Plate migration lanes. |
162+
163+
Stopping checkpoints:
164+
| Checkpoint | Type | Status | Next action |
165+
|------------|------|--------|-------------|
166+
| Core API law approval | soft review | ready | Review the final law and naming before deeper package migration. |
167+
| Runtime file split | implementation | partial | Parser, NodeId, and input-rule owners extracted; continue with another durable owner later. |
168+
| Full package sweep | implementation | partial | `code-block`, `selection`, table, utils, and list proved; link/math dirty lanes remain. |
169+
| Final review | review | pending | Run `autoreview` before commit/release claims. |
170+
171+
Closeout rule:
172+
- This checkpoint completed the API hard cut, banned-API sweep, first runtime split, and `@platejs/list` representative package migration.
173+
- Pause here for API-shape review before broad package sweep.
174+
- The next packet is link/math package migration or another focused runtime-file split; do not pretend the full package sweep is clean yet.

0 commit comments

Comments
 (0)