You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(types): fix broken .d.ts imports in published superdoc package (SD-2227) (#2392)
* fix(types): fix broken .d.ts imports in published superdoc package (SD-2227)
vite-plugin-dts was emitting .d.ts files with pnpm node_modules paths
and private workspace package imports that consumers can't resolve.
- Rewrite pnpm physical paths back to bare specifiers (253 imports)
- Fix broken subpath exports (index.js/types → types.js)
- Fix absolute-looking paths from alias resolution
- Generate ambient module shims for @superdoc/* workspace packages
- Add hand-written shims for bundled deps (prosemirror, vue, yjs, etc.)
with correct generics and class declarations
- Add global Buffer interface for Node.js type references
- Fix hand-written index.d.ts to import types before local use
Tested with skipLibCheck:true and skipLibCheck:false — 0 errors.
* fix(types): remove dead code and harden path rewriting in ensure-types
- Remove unused bundledImports collection (symbols were collected but
never used for shim generation — external shims are hand-written)
- Fix relative path rewriting to prepend ./ when relDir is empty,
preventing bare filenames from being treated as package specifiers
- Extend import scanner regex to also match `import type { ... }`
* fix(types): remove Buffer shim to avoid @types/node conflicts
The Buffer interface shim conflicts with @types/node's generic
Buffer<TArrayBuffer> declaration. Since most consumers have @types/node,
removing the shim is safer — consumers without it get a clear TS error
message suggesting `npm i --save-dev @types/node`.
Also hardens PNPM path regex to handle scoped packages (@scope/pkg).
* test(types): add consumer typecheck integration test (SD-2227)
Packs the built superdoc tarball into an isolated temp directory and
runs tsc --noEmit with skipLibCheck: false to catch broken .d.ts
imports that internal type-check doesn't detect. Added to CI pipeline
after the build step.
* fix(types): restore external shims with documented limitation
Removing prosemirror/vue/yjs shims caused 30 "Cannot find module"
errors for consumers. Restored them with an honest KNOWN LIMITATION
comment: ambient `declare module` overrides real types when both are
present — consumers who install prosemirror alongside superdoc will
see types resolve to `any`. The proper fix is adding prosemirror-*
as peerDependencies (tracked separately).
* refactor(types): address review feedback on ensure-types and test script
- Remove dead default-export branch (unreachable code)
- Remove unnecessary pnpmResult intermediate variable
- Replace 2>/dev/null with --quiet/--silent to preserve error diagnostics
- Expand KNOWN LIMITATION comment to call out vue and eventemitter3 as
guaranteed conflicts (direct deps always in consumer node_modules)
' export type ComponentOptionsBase<P = any, B = any, D = any, C = any, M = any, Mixin = any, Extends = any, E = any, EE = any, Defaults = any, I = any, II = any, S = any, LC = any, Directives = any, Exposed = any, Provide = any> = any;',
284
+
' export type ComponentOptionsMixin = any;',
285
+
' export type ComponentProvideOptions = any;',
286
+
' export type ComponentPublicInstance<P = any, B = any, D = any, C = any, M = any, E = any, S = any, Options = any, Defaults = any, MakeDefaultsOptional = any, I = any, PublicMixin = any, A = any, B2 = any, C2 = any> = any;',
287
+
' export type ComputedRef<T = any> = any;',
288
+
' export type CreateComponentPublicInstanceWithMixins<T = any, S = any, U = any, V = any, W = any, X = any, Y = any, Z = any, A = any, B = any, C = any, D = any> = any;',
289
+
' export type DefineComponent<P = any, B = any, D = any, C = any, M = any, Mixin = any, Extends = any, E = any, EE = any, PP = any, Props = any, Defaults = any, S = any> = any;',
0 commit comments