Commit 0b7ec67
authored
fix(types): drain bare @superdoc/common shim, reach zero shims (SD-2893) (#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.1 parent 630e536 commit 0b7ec67
2 files changed
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
288 | 304 | | |
289 | 305 | | |
290 | 306 | | |
| |||
300 | 316 | | |
301 | 317 | | |
302 | 318 | | |
| 319 | + | |
303 | 320 | | |
304 | 321 | | |
305 | 322 | | |
| |||
0 commit comments