Skip to content

feat(types): legacy leaf facade entries (SD-3180)#3360

Merged
caio-pizzol merged 3 commits into
mainfrom
caio-pizzol/SD-3180-legacy-leaf-facade-entries
May 17, 2026
Merged

feat(types): legacy leaf facade entries (SD-3180)#3360
caio-pizzol merged 3 commits into
mainfrom
caio-pizzol/SD-3180-legacy-leaf-facade-entries

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Three more facade files under SD-3178 / Phase 3 of SD-3175 (path-as-contract architecture). Mirrors the three single-export legacy subpaths under src/public/legacy/ so the source-side structure covers most of the legacy compatibility surface.

These were already classified as legacy in package-boundaries.md Decision 4 and already covered by SD-3176 no-growth snapshots — this PR adds the source-side facade to match.

What changes

  • packages/superdoc/src/public/legacy/converter.ts re-exports SuperConverter.
  • packages/superdoc/src/public/legacy/file-zipper.ts re-exports createZip.
  • packages/superdoc/src/public/legacy/docx-zipper.ts re-exports DocxZipper as default (preserves the existing import DocxZipper from 'superdoc/docx-zipper' contract).
  • All three import from the narrow @superdoc/super-editor/{converter,docx-zipper,file-zipper} subpaths rather than the root, so the emitted bundles stay narrow.
  • vite.config.js: three new rollup input entries.
  • verify-public-facade-emit.cjs: FACADE_ENTRIES schema extended to make the cjs field optional. Header reworded to clarify the trade-off. The three new entries set cjs: null to match the existing single-types pattern of the live superdoc/converter / superdoc/docx-zipper / superdoc/file-zipper subpaths. Phase 4 decides per-entry whether to add proper CJS shims when the contract flips.
  • 3 smoke tests, including a default-import assertion for docx-zipper.

No package.json#exports change. No package-boundaries.md change (already updated in SD-3179). No SD-3176 snapshot change (already covers these three).

Why narrow imports

Earlier draft sourced from the broad @superdoc/super-editor root, which pulled the entire super-editor graph through each facade entry. The narrow subpaths keep bundle shape close to the existing targets:

Facade Existing
converter.es.js: 335B 378B
docx-zipper.es.js: 351B 289B
file-zipper.es.js: 135B 129B

Phase 4's contract flip would otherwise have knowingly regressed bundle size on three legacy subpaths.

Verified locally

Check Result
Facade verifier clean OK across 5 entries (root: 4, legacy/headless-toolbar: 16, three new: 1 each)
Drift on legacy/converter facade .d.ts (rename SuperConverter) exit 1
Drift on legacy/docx-zipper facade .d.ts (default → named) exit 1
Emitted bundles only pull narrow chunks (no super-editor root graph) confirmed
Vitest smoke tests 8/8 pass

Related

Three more facade files under SD-3178 / Phase 3 of SD-3175. Mirrors
the three single-export legacy subpaths under `src/public/legacy/`:

  legacy/converter.ts     - re-exports SuperConverter
  legacy/file-zipper.ts   - re-exports createZip
  legacy/docx-zipper.ts   - re-exports DocxZipper as default
                            (preserves `import DocxZipper from 'superdoc/docx-zipper'`)

All three classified as legacy public compatibility surface in
package-boundaries.md Decision 4 (already updated in SD-3179).
Already covered by SD-3176 no-growth snapshots. No changes to docs
or snapshots here; this PR adds the source-side facade only.

Pipeline:

- vite.config.js: 3 new rollupOptions.input entries.
- ensure-types.cjs: NOT updated. The three existing legacy subpaths
  use a single `types` string (no .import/.require split) and have
  no .d.cts shim today; the new facade matches that pattern. The
  CJS shim generator skips `default` exports anyway, so adding a
  shim for docx-zipper would require generator work. Phase 4
  decides whether to add proper CJS shims when the contract flips.
- verify-public-facade-emit.cjs: FACADE_ENTRIES schema extended to
  make `cjs` optional. When `cjs: null`, the ESM/CJS parity check
  and the leak check on the CJS file are skipped. Three new
  entries added.
- 3 smoke tests, including a default-import assertion for
  docx-zipper.

No package.json#exports change. Phase 4 owns the contract flip.

Empirically verified:
- clean tree: OK, 5 entries
- drift on legacy/converter facade .d.ts (rename SuperConverter): exit 1
- drift on legacy/docx-zipper facade .d.ts (default → NotDefault): exit 1
- 8/8 smoke tests pass
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 17, 2026 21:03
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 17, 2026

SD-3180

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f6454e8a5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/superdoc/src/public/legacy/converter.ts Outdated
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…acade (SD-3180)

Codex review on PR #3360 caught a runtime/type contract split.

Today's `superdoc/converter` runtime
(`dist/super-editor/converter.es.js`) exports both `SuperConverter`
AND `hasBodyNumberingReferences`. The existing types entry only
declares `SuperConverter`, so the SD-3176 typed snapshot shows 1
name while the runtime contract has 2. The earlier draft of the
facade only re-exported `SuperConverter`, which would have
regressed JS consumers doing
`import { hasBodyNumberingReferences } from 'superdoc/converter'`
once Phase 4 flips package.json#exports to the facade.

Adds `hasBodyNumberingReferences` to:

- packages/superdoc/src/public/legacy/converter.ts (typed re-export
  through the narrow `@superdoc/super-editor/converter` subpath,
  which already exposes both names at runtime)
- FACADE_ENTRIES['legacy/converter'].expectedNames (now 2 names)
- converter.test.ts (runtime smoke assertion)

This is "type the existing runtime contract correctly" rather than
"grow the surface". The SD-3176 baseline for the live
`superdoc/converter` subpath stays at 1 (it tracks the old types
entry until Phase 4 flips).

Verified:
- pnpm run build:es: pass
- verifier: 5 entries clean, legacy/converter: 2 exports
- vitest converter.test.ts: 2/2 pass
@caio-pizzol caio-pizzol merged commit 598017f into main May 17, 2026
70 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-3180-legacy-leaf-facade-entries branch May 17, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants