feat(core): expose framework-adapter subpaths via exports map#273
feat(core): expose framework-adapter subpaths via exports map#273sted wants to merge 2 commits intoeigenpal:mainfrom
Conversation
|
@sted is attempting to deploy a commit to the EigenPal Team on Vercel. A member of the Team first needs to authorize it. |
|
Closing this for now — needs more work before it's ready. While validating the new subpath surface from an external framework adapter (consuming the built dist via npm), we hit an evaluation-order bug: The fix belongs with this PR, not as a follow-up — shipping the subpath exports without it would expose a surface that doesn't actually work for external consumers. Will reopen once we've validated a lazy-init (or cycle-break) fix end-to-end. Keeping the branch around; thanks for your patience. |
|
Reopened with the init-order fix. Scope now:
Validated end-to-end: built dist consumed from an external Svelte adapter, editor loads, commands work. |
Adds explicit subpath exports for internals that framework adapters
(outside packages/{react,vue}) need to consume without reaching into
src/. Replaces the `./*` catch-all with a curated surface at directory
boundaries.
New subpaths:
./prosemirror, ./prosemirror/extensions, ./prosemirror/editor.css
./layout-engine, ./layout-painter
./layout-bridge/{toFlowBlocks,measuring,clickToPositionDom,selectionRects}
./managers, ./plugin-api, ./types, ./utils/textSelection
Also:
- tsup.config.ts: add matching entry keys so dist mirrors src layout
- scripts/copy-assets.mjs: copy editor.css into dist/ post-build
- layout-painter: re-export HeaderFooterContent type
- Move prosemirror-* from dependencies to peerDependencies: consumers
own the PM version, which avoids duplicate PM copies in consumer
bundles (previously needed resolve.dedupe workarounds).
Break the `schema` → `StarterKit` → `extensions` → `schema` circular import that causes `X is not a function` when the package is consumed as a built bundle. Root cause: `BidiShortcutExtension` imported `singletonManager` directly from `../../schema`. The resulting cycle works by accident under monorepo workspace aliasing (source-level ESM with live bindings) but fails when bundled — `var` bindings for extension factories aren't yet assigned when `schema/index.ts`'s top-level `new ExtensionManager( createStarterKit())` executes. Fix: give extensions access to their own manager via `ExtensionContext` instead of reaching back to a global singleton. - types.ts: add `manager: ExtensionManager` to ExtensionContext - ExtensionManager.ts: pass `this` when building ctx for onSchemaReady - BidiShortcutExtension.ts: use ctx.manager.getCommands() instead of the imported singletonManager.getCommands() No API surface change for consumers. `singletonManager` and `schema` top-level exports remain untouched. Tests updated to pass a stub manager. Arguably better design independently of the bundling issue: extensions shouldn't reach back to a module-level singleton; their manager is already in scope via the context they receive.
1b74508 to
b044bb6
Compare
Summary
Adds explicit subpath exports for internals that framework adapters
(outside packages/{react,vue}) need to consume without reaching into
src/. Replaces the
./*catch-all with a curated surface at directoryboundaries.
New subpaths:
./prosemirror, ./prosemirror/extensions, ./prosemirror/editor.css
./layout-engine, ./layout-painter
./layout-bridge/{toFlowBlocks,measuring,clickToPositionDom,selectionRects}
./managers, ./plugin-api, ./types, ./utils/textSelection
Also:
own the PM version, which avoids duplicate PM copies in consumer
bundles (previously needed resolve.dedupe workarounds).
Test plan
bun run typecheckpassesbun testpassesbun run buildsucceeds