feat(sdk): export internal types from public index for bundler resolution [SPA-4097]#1596
Conversation
…tion These types were previously only reachable via internal dist/ paths (e.g. @contentful/live-preview/dist/types), which worked under moduleResolution:node but fails under moduleResolution:bundler (Angular v21 default) because unlisted exports map entries are rejected. Exports added: Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, InspectorModeTags. Adding them to the public index entry is additive and non-breaking. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Code Review Agent Run #ea9b4eActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Changelist by BitoThis pull request implements the following key changes.
|
Impact Analysis by BitoInteraction DiagramsequenceDiagram
participant Types as types.ts
participant InspectorTypes as inspectorMode/types.ts
participant Index as index.ts<br/>🔄 Updated | ●●○ Medium
participant React as react.tsx
participant Messages as messages.ts
participant SaveEvent as saveEvent.ts
participant InspectorIndex as inspectorMode/index.ts
participant Utils as inspectorMode/utils.ts
participant Tests as __tests__/react.spec.tsx
Types->>React: provides Argument type for useContentfulLiveUpdates
Types->>Messages: provides Argument type for message data
InspectorTypes->>Index: provides InspectorModeDataAttributes for inspector mode
Index->>Index: adds export of Argument and SubscribeCallback
Index->>Index: adds export of InspectorModeDataAttributes, InspectorModeEntryTags, InspectorModeTags
Types->>SaveEvent: provides SubscribeCallback for subscription callbacks
InspectorTypes->>InspectorIndex: provides InspectorModeDataAttributes
InspectorTypes->>Utils: provides InspectorModeDataAttributes for attribute checking
Types->>Tests: provides Argument for testing
InspectorTypes->>Tests: provides InspectorModeDataAttributes for testing
Note over Index: These exports make the types available<br/>to external consumers of the SDK
The MR adds exports for Argument and SubscribeCallback types from types.ts, and InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags from inspectorMode/types.ts. This exposes additional type definitions for external consumers of the live-preview-sdk package, enabling better TypeScript support for live preview and inspector mode functionality. No direct upstream/downstream impact detected in repository scan or cross-repo dependency analysis. Code Paths AnalyzedImpact: Flow: Direct Changes (Diff Files): Repository Impact: Cross-Repository Dependencies: Database/Caching Impact: API Contract Violations: Infrastructure Dependencies: Additional Insights: Testing RecommendationsFrontend Impact: Service Integration: Data Serialization: Privacy Compliance: Backward Compatibility: OAuth Functionality: Reliability Testing: Additional Insights: Analysis based on known dependency patterns and edges. Actual impact may vary. |
Code Review Agent Run #314be9Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
| Source | Requirement / Code Area | Status | Notes |
|---|---|---|---|
| SPA-4097 | Support bundler module resolution for Angular | ❌ Missed | No changes in the PR diff address supporting bundler module resolution for Angular. The TypeScript configuration still uses 'NodeNext' moduleResolution, and the ticket indicates the actual problem is with the connector in a separate repository (https://github.com/contentful/composable-storefront-integration-library). |
| index.ts | Added exports for Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags in packages/live-preview-sdk/src/index.ts | ⭕ Out of Scope | Added exports for Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags in packages/live-preview-sdk/src/index.ts |
Summary
Argument,SubscribeCallback,InspectorModeDataAttributes,InspectorModeEntryTags, andInspectorModeTagsfrom the public@contentful/live-previewentry pointTS2307: Cannot find moduleerrors for consumers usingmoduleResolution: "bundler"(Angular v20/v21 default), who previously had to import from internaldist/paths not listed in theexportsmapContext
The composable-storefront-integration-library imports these types from
@contentful/live-preview/dist/typesand@contentful/live-preview/dist/inspectorMode/types. UndermoduleResolution: "node"TypeScript bypasses theexportsmap and resolves those paths directly. UndermoduleResolution: "bundler"(Angular v21 default) TypeScript enforces theexportsmap strictly — those unlisted paths are rejected withTS2307. This PR makes the fix on the SDK side.Summary by Bito
This PR re-exports internal types from the public index to resolve TypeScript module resolution errors for consumers using 'bundler' mode, ensuring compatibility with Angular v20/v21 defaults without impacting existing users. The changes add exports for Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags, and include corresponding test adjustments in index.spec.ts.
Detailed Changes