Skip to content

fix(types): drain @superdoc/common/list-marker-utils shim (SD-2893)#3150

Merged
caio-pizzol merged 2 commits intomainfrom
caio-pizzol/SD-2893-stack-3-list-marker
May 5, 2026
Merged

fix(types): drain @superdoc/common/list-marker-utils shim (SD-2893)#3150
caio-pizzol merged 2 commits intomainfrom
caio-pizzol/SD-2893-stack-3-list-marker

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Stacked on #3140. Drains the third remaining shim entry, dropping the count from 4 to 3.

list-marker-utils is the only @superdoc/common subpath publicly reachable today, via painter-dom/src/utils/marker-helpers. The bare @superdoc/common package and other subpaths stay shimmed for separate follow-ups.

Why this doesn't add to vite-plugin-dts's include: extending the include list with ../../shared/common/... shifts the common-ancestor to the repo root and reorganises the whole dist tree. To avoid that, the postbuild step runs tsc directly on the two source files (list-marker-utils.ts plus its sibling layout-constants.ts dependency) and emits the declarations into dist/shared/common/. Same effect, no tree-shape change.

The exact relocation rule + guard entry follow the SD-2893 pattern established by the pm-adapter subpath rules. Audit Rule 1 / Rule 3 still cover the bare @superdoc/common shim that remains.

Remaining shims (3): @superdoc/common, @superdoc/common/components/BasicUpload.vue, @superdoc/style-engine/ooxml.

Verified:

  • pnpm --filter superdoc build:es clean (audit OK, 8 guarded packages, 3 shim modules)
  • Consumer matrix: 47 passed, 0 failed, 0 warnings
  • Runtime smoke: 4/4 against the freshly packed tarball
  • Negative test: import('@superdoc/common/list-marker-utils') rewrites to ./shared/common/list-marker-utils.js and the target file exists in dist

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.
list-marker-utils is the only @superdoc/common subpath publicly
reachable today (via painter-dom/src/utils/marker-helpers). Adding
shared/common to vite-plugin-dts's include shifts the common
ancestor to the repo root and reorganises the entire dist tree, so
emit declarations directly via tsc in the postbuild step instead.

Adds the file plus its sibling layout-constants dependency to
dist/shared/common, registers an exact relocation rule, and guards
the subpath against a future shim regression. The bare
@superdoc/common package and other subpaths stay shimmed until
separately drained.

Shim count: 4 to 3. Remaining: @superdoc/common,
@superdoc/common/components/BasicUpload.vue, @superdoc/style-engine/ooxml.

Verified: build:es clean, declaration audit clean (8 guarded),
consumer matrix 47/0/0, runtime smoke 4/4, negative test confirms
the painter-dom consumer rewrites to dist/shared/common/list-marker-utils.d.ts.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 5, 2026 11:07
@linear
Copy link
Copy Markdown

linear Bot commented May 5, 2026

Base automatically changed from caio-pizzol/SD-2893-stack-2-shim-probe to main May 5, 2026 11:17
@caio-pizzol caio-pizzol merged commit 4458d02 into main May 5, 2026
42 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-2893-stack-3-list-marker branch May 5, 2026 11:17
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.48

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.92

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.90

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in superdoc-cli v0.8.0-next.66

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in superdoc v1.30.0-next.49

The release is available on GitHub release

caio-pizzol added a commit that referenced this pull request May 5, 2026
The remaining @superdoc/common shim is referenced by three internal
dist d.ts files for four Comment* types (Comment, CommentContent,
CommentJSON, CommentThreadingProfile). All four live in
shared/common/comments-types.ts.

Approach matches the list-marker-utils pattern from #3150: tsc-emit
just comments-types.ts into dist/shared/common/, then rewrite bare
@superdoc/common imports to that file. matchSubpaths: false because
only the bare specifier is referenced; any future
@superdoc/common/<other-subpath> import falls through to the shim
generator and audit Rule 3 fires (because @superdoc/common is now
in RELOCATION_GUARD_PACKAGES, the regex matches the subpath).

Verified end-to-end: a synthetic
@superdoc/common/some-other-subpath probe is left unchanged by
ensure-types, the shim generator captures it, audit Rule 3 fails
with exit 1.

The existing inline-replacement step at ensure-types.cjs:89-119
that handles the main entry's runtime-value imports (DOCX, PDF,
HTML, getFileObject, compareVersions, BlankDOCX) stays as-is. Two
paths through the script address different concerns:

- Inline-replacement: runtime values from @superdoc/common in
  superdoc/src/index.d.ts (handles those 6 specific imports)
- Relocation rule: bare @superdoc/common type imports in three
  internal dist d.ts files (resolves to comments-types.d.ts)

Shim count: 1 to 0. Final shim drain. _internal-shims.d.ts has no
declare-module entries; all originally-shimmed @superdoc/* packages
have been relocated, removed from the public surface, or guarded.

Verified: build:es clean (10 guarded packages, 0 shim modules),
consumer matrix 47/0/0, runtime smoke 4/4, dist has the relocation
target at shared/common/comments-types.d.ts, the three consumer
d.ts files now import from a relative path. Negative test confirms
the audit gate catches future @superdoc/common subpath leaks.
caio-pizzol added a commit that referenced this pull request May 5, 2026
…93) (#3154)

The remaining @superdoc/common shim is referenced by three internal
dist d.ts files for four Comment* types (Comment, CommentContent,
CommentJSON, CommentThreadingProfile). All four live in
shared/common/comments-types.ts.

Approach matches the list-marker-utils pattern from #3150: tsc-emit
just comments-types.ts into dist/shared/common/, then rewrite bare
@superdoc/common imports to that file. matchSubpaths: false because
only the bare specifier is referenced; any future
@superdoc/common/<other-subpath> import falls through to the shim
generator and audit Rule 3 fires (because @superdoc/common is now
in RELOCATION_GUARD_PACKAGES, the regex matches the subpath).

Verified end-to-end: a synthetic
@superdoc/common/some-other-subpath probe is left unchanged by
ensure-types, the shim generator captures it, audit Rule 3 fails
with exit 1.

The existing inline-replacement step at ensure-types.cjs:89-119
that handles the main entry's runtime-value imports (DOCX, PDF,
HTML, getFileObject, compareVersions, BlankDOCX) stays as-is. Two
paths through the script address different concerns:

- Inline-replacement: runtime values from @superdoc/common in
  superdoc/src/index.d.ts (handles those 6 specific imports)
- Relocation rule: bare @superdoc/common type imports in three
  internal dist d.ts files (resolves to comments-types.d.ts)

Shim count: 1 to 0. Final shim drain. _internal-shims.d.ts has no
declare-module entries; all originally-shimmed @superdoc/* packages
have been relocated, removed from the public surface, or guarded.

Verified: build:es clean (10 guarded packages, 0 shim modules),
consumer matrix 47/0/0, runtime smoke 4/4, dist has the relocation
target at shared/common/comments-types.d.ts, the three consumer
d.ts files now import from a relative path. Negative test confirms
the audit gate catches future @superdoc/common subpath leaks.
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