fix(types): drain layout-engine and useUiFontFamily shims (SD-2893)#3140
Open
caio-pizzol wants to merge 4 commits intomainfrom
Open
fix(types): drain layout-engine and useUiFontFamily shims (SD-2893)#3140caio-pizzol wants to merge 4 commits intomainfrom
caio-pizzol wants to merge 4 commits intomainfrom
Conversation
…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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3133. Two cheap-win follow-ups to the D1 relocation, dropping the internal shim count from 6 to 4.
@superdoc/composables/useUiFontFamily.jsspecifier only appeared in a JSDoc@exampleblock. 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 fullsrc/**/*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, andstyle-engine/ooxml(10 files, deep dependency).Verified: matrix 47/0/0, build:es clean, declaration audit clean (7 guarded packages, 4 modules in shim).