Skip to content

[CustomCatalog] Surface sanitizeCatalogImageUrl in the bundled d.ts#1697

Open
claude[bot] wants to merge 1 commit into
masterfrom
claude/my-designs-bugs-refactor-khpice
Open

[CustomCatalog] Surface sanitizeCatalogImageUrl in the bundled d.ts#1697
claude[bot] wants to merge 1 commit into
masterfrom
claude/my-designs-bugs-refactor-khpice

Conversation

@claude

@claude claude Bot commented Jul 8, 2026

Copy link
Copy Markdown

Notes for Reviewers

sanitizeCatalogImageUrl (added for the catalog snapshot-URL sanitization work) ships at runtime but reaches the package entry only through export * from './custom' nested barrels. rollup-plugin-dts — the tsup declaration bundler — drops such symbols from the published dist/index.d.ts, so consumers importing it type-fail with TS2305: Module '@sistent/sistent' has no exported member 'sanitizeCatalogImageUrl' even though the runtime export exists. This is the same nested-barrel quirk already documented in src/index.tsx for FeedbackButton, TableActions, DangerConfirmationModal and UniversalFilter.

This PR:

  • Extracts sanitizeCatalogImageUrl into a dependency-free leaf module (src/custom/CustomCatalog/sanitizeCatalogImageUrl.ts). Re-exporting it directly from Helper.ts would drag that module's untyped js-yaml import into the declaration graph and crash the dts build — the same rationale that keeps getCopyDeepLinkAction/TableAction in the leaf TableActions module rather than ResponsiveDataTable.
  • Adds an explicit export { sanitizeCatalogImageUrl } from './custom/CustomCatalog/sanitizeCatalogImageUrl' to src/index.tsx, forcing the declaration into the bundled dist/index.d.ts.
  • Helper.ts re-exports from the leaf so the existing from './Helper' import path keeps working for internal consumers (CatalogCardDesignLogo, CustomCatalog/index).

Verification: NODE_ENV=production tsup builds clean and dist/index.d.ts now declares sanitizeCatalogImageUrl: (rawUrl?: string) => string | undefined and lists it in the export barrel; the sanitizeCatalogImageUrl Jest suite passes. Once released, downstream consumers can drop their local .d.ts shim for this symbol and import it type-safely.

Signed commits

  • Yes, I signed my commits.

Generated by Claude Code

sanitizeCatalogImageUrl ships at runtime but reaches the package entry only
through 'export * from ./custom' nested barrels, so rollup-plugin-dts (the tsup
declaration bundler) drops its type from the published dist/index.d.ts. Consumers
importing it type-fail with TS2305 even though the runtime export exists — the
same nested-barrel quirk already documented for FeedbackButton, TableActions,
DangerConfirmationModal and UniversalFilter.

Extract the function into a dependency-free leaf module
(custom/CustomCatalog/sanitizeCatalogImageUrl.ts) and add an explicit re-export
from src/index.tsx. The leaf placement mirrors the TableActions-vs-
ResponsiveDataTable rationale: re-exporting directly from Helper.ts would drag its
untyped js-yaml import into the declaration graph and crash the dts build. Helper.ts
re-exports from the leaf so the existing 'from ./Helper' import path is preserved.

Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant