Skip to content

fix(types): drain layout-engine and useUiFontFamily shims (SD-2893)#3140

Open
caio-pizzol wants to merge 4 commits intomainfrom
caio-pizzol/SD-2893-stack-2-shim-probe
Open

fix(types): drain layout-engine and useUiFontFamily shims (SD-2893)#3140
caio-pizzol wants to merge 4 commits intomainfrom
caio-pizzol/SD-2893-stack-2-shim-probe

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Stacked on #3133. Two cheap-win follow-ups to the D1 relocation, dropping the internal shim count from 6 to 4.

  • useUiFontFamily: the bare @superdoc/composables/useUiFontFamily.js specifier only appeared in a JSDoc @example block. The example was also misleading. The composable is internal-only, not exported from any public entry, so a consumer cannot actually use the shown import. Removing the example clears the shim without changing public API.
  • @superdoc/layout-engine: relocate via the same D1 pattern as contracts and layout-bridge. The package's source only imports from @superdoc/contracts (already relocated), so a full src/**/* glob is safe and does not pull additional internal packages into the declaration graph.

Remaining shims need more evaluation than a cheap-win slice: @superdoc/common (referenced by 5 dist files including public types), common/components/BasicUpload.vue (publicly re-exported runtime component), common/list-marker-utils, and style-engine/ooxml (10 files, deep dependency).

Verified: matrix 47/0/0, build:es clean, declaration audit clean (7 guarded packages, 4 modules in shim).

…ack (SD-2893)

vite.config.js: pm-adapter is included file-by-file because a full
src/**/* glob pulls @superdoc/style-engine and other internal packages
into the declaration graph, defeating the SD-2893 shim drain.

ensure-types.cjs: bare @superdoc/pm-adapter specifiers would rewrite to
a non-existent dist path. The audit gate's RELOCATED_PACKAGES list
rejects any unrewritten bare specifier at build time, so this is a
build failure rather than a silent consumer break.
Two cheap-win follow-ups to the D1 relocation. Shim count: 6 to 4.

useUiFontFamily: the bare @superdoc/composables/useUiFontFamily.js
specifier only appeared inside a JSDoc @example block. The example
was also misleading; this composable is not exported from any public
entry, so a consumer cannot use the shown import. Removing the
example clears the shim without changing public API.

@superdoc/layout-engine: relocate via the same D1 pattern as
contracts and layout-bridge. layout-engine only imports from
@superdoc/contracts (already relocated), so a full src/**/* glob is
safe and does not pull additional internal packages into the
declaration graph.

Remaining shims: @superdoc/common, common/components/BasicUpload.vue,
common/list-marker-utils, style-engine/ooxml. Each needs more
evaluation than a cheap-win slice.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 5, 2026 00:23
@linear
Copy link
Copy Markdown

linear Bot commented May 5, 2026

Base automatically changed from caio-pizzol/SD-2893-d1-shim-relocations to main May 5, 2026 00:27
The previous comment claimed the audit gate would catch a bare
@superdoc/pm-adapter leak, but ensure-types.cjs runs before
audit-declarations.cjs and was rewriting bare specifiers to a
relative path that does not exist in dist (vite.config.js only emits
two specific subpaths, not the full src/**/* tree). After the
rewrite, audit Rule 1 saw no bare specifier and Rule 3 saw no shim
regression, so a broken relative path would have shipped silently to
consumers.

Add a subpathOnly flag to the relocation rule. The rewriter now
leaves bare specifiers untouched for subpathOnly rules so audit
Rule 1 catches them as a private workspace leak at build time.

Verified end-to-end: synthetic injection of a bare @superdoc/pm-adapter
specifier into dist passes through ensure-types unchanged and fails
audit-declarations with exit 1. Existing subpath imports
(converter-context.js, sections/types.js) still rewrite correctly.
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.

1 participant