From 4eb6f7248634acae127135c235dedb6cad37e7b8 Mon Sep 17 00:00:00 2001 From: Caio Pizzol Date: Tue, 5 May 2026 08:23:12 -0300 Subject: [PATCH 1/2] fix(types): drop accidental BasicUpload public re-export (SD-2893) BasicUpload was re-exported through `superdoc/super-editor` and `superdoc` despite being marked `@internal` at the export site (packages/super-editor/src/editors/v1/index.js:103). It is not documented in any README, AGENTS guide, or example. The two dev components that use it (SuperdocDev.vue, DeveloperPlayground.vue) import it directly from `@superdoc/common/components/BasicUpload.vue`, not via the public re-export. Drop the re-export rather than relocating the .vue file. The upload widget is dev-tooling, not a public API. The bare `@superdoc/common/components/BasicUpload.vue` shim entry goes away because no public d.ts file references it anymore. Also removes the BasicUpload assertion from the consumer-typecheck customer-scenario fixture so the matrix stays green; the fixture was the only place the public re-export was exercised. Shim count: 3 to 2. Remaining: @superdoc/common (5 dist refs, catch-all bin), @superdoc/style-engine/ooxml (10 dist refs). Verified: build:es clean (8 guarded packages, 2 shim modules), consumer matrix 47/0/0, runtime smoke 4/4 with BasicUpload explicitly asserted absent from main and super-editor entries. --- packages/super-editor/src/editors/v1/index.js | 3 --- packages/superdoc/src/index.js | 2 -- tests/consumer-typecheck/src/customer-scenario.ts | 2 -- 3 files changed, 7 deletions(-) diff --git a/packages/super-editor/src/editors/v1/index.js b/packages/super-editor/src/editors/v1/index.js index 7e2989eebc..0979a94485 100644 --- a/packages/super-editor/src/editors/v1/index.js +++ b/packages/super-editor/src/editors/v1/index.js @@ -33,7 +33,6 @@ import { Mark } from '@core/Mark.js'; import ContextMenu from './components/context-menu/ContextMenu.vue'; /** @deprecated Use ContextMenu instead */ const SlashMenu = ContextMenu; -import BasicUpload from '@superdoc/common/components/BasicUpload.vue'; import SuperEditor from './components/SuperEditor.vue'; import Toolbar from './components/toolbar/Toolbar.vue'; @@ -100,8 +99,6 @@ export { SuperEditor, /** @internal */ SuperInput, - /** @internal */ - BasicUpload, Toolbar, AIWriter, ContextMenu, diff --git a/packages/superdoc/src/index.js b/packages/superdoc/src/index.js index 1034020a8c..d0bf89b4ad 100644 --- a/packages/superdoc/src/index.js +++ b/packages/superdoc/src/index.js @@ -28,7 +28,6 @@ import { // Vue components SuperEditor, SuperInput, - BasicUpload, Toolbar, AIWriter, ContextMenu, @@ -289,7 +288,6 @@ export { // Vue components SuperEditor, SuperInput, - BasicUpload, Toolbar, AIWriter, ContextMenu, diff --git a/tests/consumer-typecheck/src/customer-scenario.ts b/tests/consumer-typecheck/src/customer-scenario.ts index 2e685875bb..178a499167 100644 --- a/tests/consumer-typecheck/src/customer-scenario.ts +++ b/tests/consumer-typecheck/src/customer-scenario.ts @@ -42,7 +42,6 @@ import { CommentsPluginKey, SuperEditor, SuperInput, - BasicUpload, Toolbar, AIWriter, ContextMenu, @@ -831,7 +830,6 @@ function testAdditionalClasses() { function testVueComponents() { const superEditor = SuperEditor; const superInput = SuperInput; - const basicUpload = BasicUpload; const toolbarComponent = Toolbar; const aiWriter = AIWriter; const contextMenu = ContextMenu; From e65ddb728002f2aa494e9ef937ae50e1ca372e54 Mon Sep 17 00:00:00 2001 From: Caio Pizzol Date: Tue, 5 May 2026 08:36:52 -0300 Subject: [PATCH 2/2] fix(types): drain @superdoc/style-engine/ooxml shim (SD-2893) The /ooxml subpath of style-engine is the only part publicly reachable today (10 dist d.ts references across pm-adapter, diffing, super-converter, parts adapters, and plan-engine). Approach mirrors the pm-adapter narrow-scope pattern from #3144: - Include only the ooxml subtree plus its sibling cascade.ts dependency in vite-plugin-dts. A full src/**/* glob would pull the broader project graph through @superdoc/contracts project references and re-expand the shim list. - Add an exact relocation rule for @superdoc/style-engine/ooxml. - Guard the bare @superdoc/style-engine root in both RELOCATION_GUARD_PACKAGES and UNSHIMMED_PRIVATE_SPECIFIERS so a future bare-barrel leak fails audit Rule 1 instead of producing a broken relative path or an ambient any shim. Also removes a misleading JSDoc @example block from cascade.ts. The example showed `import from '@superdoc/style-engine/cascade'` which is not a valid public import (cascade is not in the package's exports field), and the bare specifier inside the @example was being captured by the workspace-import scanner. Shim count: 2 to 1. Only @superdoc/common remains. Verified: build:es clean (9 guarded packages, 1 shim module), consumer matrix 47/0/0, runtime smoke 4/4, dist has the 6 expected declaration files, negative tests confirm the /ooxml subpath rewrites to a real target file and a bare @superdoc/style-engine specifier is preserved unchanged for audit Rule 1 to catch. --- .../layout-engine/style-engine/src/cascade.ts | 21 ------------------- .../superdoc/scripts/audit-declarations.cjs | 1 + packages/superdoc/scripts/ensure-types.cjs | 12 +++++++++++ packages/superdoc/tsconfig.json | 4 +++- packages/superdoc/vite.config.js | 6 ++++++ 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/layout-engine/style-engine/src/cascade.ts b/packages/layout-engine/style-engine/src/cascade.ts index 9b62ba772c..505db8d310 100644 --- a/packages/layout-engine/style-engine/src/cascade.ts +++ b/packages/layout-engine/style-engine/src/cascade.ts @@ -24,27 +24,6 @@ export type PropertyObject = ParagraphProperties | RunProperties | TableCellProp * @param propertiesArray - Ordered list of property objects to combine (low -> high priority). * @param options - Configuration for full overrides and special handling. * @returns Combined property object. - * - * @example - * ```typescript - * import { combineProperties } from '@superdoc/style-engine/cascade'; - * - * const result = combineProperties([ - * { fontSize: 22, bold: true }, // from style - * { fontSize: 24, italic: true }, // from inline (wins for fontSize) - * ]); - * // result: { fontSize: 24, bold: true, italic: true } - * - * // With full override for color (replaces entire object, not merge): - * const result2 = combineProperties( - * [ - * { color: { val: 'FF0000', theme: 'accent1' } }, - * { color: { val: '00FF00' } }, - * ], - * { fullOverrideProps: ['color'] } - * ); - * // result2: { color: { val: '00FF00' } } - NOT merged - * ``` */ export function combineProperties( propertiesArray: T[], diff --git a/packages/superdoc/scripts/audit-declarations.cjs b/packages/superdoc/scripts/audit-declarations.cjs index 86c7326397..ba928eef16 100644 --- a/packages/superdoc/scripts/audit-declarations.cjs +++ b/packages/superdoc/scripts/audit-declarations.cjs @@ -72,6 +72,7 @@ const RELOCATION_GUARD_PACKAGES = [ '@superdoc/layout-engine', '@superdoc/painter-dom', '@superdoc/pm-adapter', + '@superdoc/style-engine', '@superdoc/common/list-marker-utils', ]; diff --git a/packages/superdoc/scripts/ensure-types.cjs b/packages/superdoc/scripts/ensure-types.cjs index e483a21733..66a92455bb 100644 --- a/packages/superdoc/scripts/ensure-types.cjs +++ b/packages/superdoc/scripts/ensure-types.cjs @@ -275,6 +275,16 @@ const RELOCATION_RULES = [ distEntry: 'shared/common/list-marker-utils.d.ts', matchSubpaths: false, }, + // SD-2893: only the /ooxml subpath of style-engine is publicly reachable. + // Relocate just this subpath plus its sibling cascade.ts dependency + // (see vite.config.js include list). The bare @superdoc/style-engine is + // guarded but unrewritten; if a future bare-barrel leak appears the audit + // gate fails rather than producing a missing relative path. + { + pkg: '@superdoc/style-engine/ooxml', + distEntry: 'layout-engine/style-engine/src/ooxml/index.d.ts', + matchSubpaths: false, + }, ]; // Guard packages that must never fall back to `_internal-shims.d.ts`. @@ -289,6 +299,7 @@ const RELOCATION_GUARD_PACKAGES = [ '@superdoc/layout-engine', '@superdoc/painter-dom', '@superdoc/pm-adapter', + '@superdoc/style-engine', '@superdoc/common/list-marker-utils', ]; @@ -329,6 +340,7 @@ const RELOCATION_REWRITERS = RELOCATION_RULES.map((rule) => ({ // shim after we intentionally skip shim generation. const UNSHIMMED_PRIVATE_SPECIFIERS = new Set([ '@superdoc/pm-adapter', + '@superdoc/style-engine', ]); function shouldSkipWorkspaceShim(mod) { diff --git a/packages/superdoc/tsconfig.json b/packages/superdoc/tsconfig.json index 00ea821601..ecd714aa6b 100644 --- a/packages/superdoc/tsconfig.json +++ b/packages/superdoc/tsconfig.json @@ -32,6 +32,8 @@ "../layout-engine/layout-engine/src", "../layout-engine/painters/dom/src", "../layout-engine/pm-adapter/src/converter-context.ts", - "../layout-engine/pm-adapter/src/sections/types.ts" + "../layout-engine/pm-adapter/src/sections/types.ts", + "../layout-engine/style-engine/src/ooxml", + "../layout-engine/style-engine/src/cascade.ts" ] } diff --git a/packages/superdoc/vite.config.js b/packages/superdoc/vite.config.js index f45fe8f863..177fd6b22a 100644 --- a/packages/superdoc/vite.config.js +++ b/packages/superdoc/vite.config.js @@ -140,6 +140,12 @@ export default defineConfig(({ mode, command }) => { // type subpaths reachable from the public surface are relocated. '../layout-engine/pm-adapter/src/converter-context.ts', '../layout-engine/pm-adapter/src/sections/types.ts', + // SD-2893: only the /ooxml subpath of style-engine is publicly + // reachable today. Include the ooxml subtree plus the cascade.ts + // sibling it depends on. The full src/**/* glob pulls the broader + // project graph through contracts project references. + '../layout-engine/style-engine/src/ooxml/**/*', + '../layout-engine/style-engine/src/cascade.ts', ], outDir: 'dist', // vite-plugin-dts still gathers diagnostics for this mixed JS/Vue source