Skip to content

feat(sdk): export internal types from public index for bundler resolution [SPA-4097]#1596

Merged
Thomas Kellermeier (Chaoste) merged 2 commits intomainfrom
feat/bundler-module-resolution-support
Apr 17, 2026
Merged

feat(sdk): export internal types from public index for bundler resolution [SPA-4097]#1596
Thomas Kellermeier (Chaoste) merged 2 commits intomainfrom
feat/bundler-module-resolution-support

Conversation

@Chaoste
Copy link
Copy Markdown
Contributor

@Chaoste Thomas Kellermeier (Chaoste) commented Apr 17, 2026

Summary

  • Re-exports Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags from the public @contentful/live-preview entry point
  • Fixes TS2307: Cannot find module errors for consumers using moduleResolution: "bundler" (Angular v20/v21 default), who previously had to import from internal dist/ paths not listed in the exports map
  • Purely additive — no existing consumers are affected

Context

The composable-storefront-integration-library imports these types from @contentful/live-preview/dist/types and @contentful/live-preview/dist/inspectorMode/types. Under moduleResolution: "node" TypeScript bypasses the exports map and resolves those paths directly. Under moduleResolution: "bundler" (Angular v21 default) TypeScript enforces the exports map strictly — those unlisted paths are rejected with TS2307. 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
  • Adds export statements for Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags in index.ts from their respective internal modules to make them publicly accessible.
  • Removes imports of the exported types from the public index and the associated test cases in index.spec.ts, instead importing InspectorModeDataAttributes directly from its internal module.

…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>
@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented Apr 17, 2026

Code Review Agent Run #ea9b4e

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 53d91ad..53d91ad
    • packages/live-preview-sdk/src/__tests__/index.spec.ts
    • packages/live-preview-sdk/src/index.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented Apr 17, 2026

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted Summary
New Feature - Export Internal Types to Public API
Re-exports specific internal types to the public index and adjusts the test file by removing redundant imports and tests, fixing bundler resolution issues.

@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented Apr 17, 2026

Impact Analysis by Bito

Interaction Diagram
sequenceDiagram
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
Loading

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 Analyzed

Impact:
The change adds new type exports to the public API of the live-preview-sdk package, making internal TypeScript types available for external consumption. This enhances type safety for consumers integrating with the SDK's inspector mode and subscription features.

Flow:
The modification occurs in the barrel export file (index.ts) of the live-preview-sdk package. Data flow remains internal to the package's type definitions, with the new exports enabling typed access to Argument and SubscribeCallback for subscription configurations, and InspectorModeDataAttributes, InspectorModeEntryTags, InspectorModeTags for inspector mode functionality.

Direct Changes (Diff Files):
• packages/live-preview-sdk/src/index.ts [413-418] — Added export statements for Argument and SubscribeCallback types from './types.js', and InspectorModeDataAttributes enum along with InspectorModeEntryTags and InspectorModeTags types from './inspectorMode/types.js'.

Repository Impact:
live-preview-sdk package public API: New types are exposed in the package's index.ts, allowing consumers to import and use these types for better TypeScript integration with subscription callbacks and inspector mode attributes.

Cross-Repository Dependencies:
None.

Database/Caching Impact:
• None

API Contract Violations:
None.

Infrastructure Dependencies:
None.

Additional Insights:
Type safety and developer experience: Exporting these types enables consumers to have proper TypeScript intellisense and type checking when using the SDK's subscription and inspector mode features.

Testing Recommendations

Frontend Impact:
None.

Service Integration:
None.

Data Serialization:
None.

Privacy Compliance:
None.

Backward Compatibility:
• Verify that adding these type exports does not introduce any breaking changes or type conflicts in existing consumer codebases.

OAuth Functionality:
• None

Reliability Testing:
• None

Additional Insights:
• Add unit tests in index.spec.ts to verify that the new types (Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, InspectorModeTags) can be imported successfully from the package's main export.
• Ensure TypeScript compilation passes with the new exports and that consumers can use these types without import errors.
• Test that the exported types match their intended usage in subscription and inspector mode contexts.

Analysis based on known dependency patterns and edges. Actual impact may vary.

@Chaoste Thomas Kellermeier (Chaoste) changed the title feat(sdk): export internal types from public index for bundler resolution feat(sdk): export internal types from public index for bundler resolution [SPA-4097] Apr 17, 2026
@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented Apr 17, 2026

Code Review Agent Run #314be9

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 53d91ad..8924e49
    • packages/live-preview-sdk/src/__tests__/index.spec.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review
Copy link
Copy Markdown

Functional Validation by Bito

SourceRequirement / Code AreaStatusNotes
SPA-4097Support bundler module resolution for Angular❌ MissedNo 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.tsAdded exports for Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags in packages/live-preview-sdk/src/index.ts⭕ Out of ScopeAdded exports for Argument, SubscribeCallback, InspectorModeDataAttributes, InspectorModeEntryTags, and InspectorModeTags in packages/live-preview-sdk/src/index.ts

@Chaoste Thomas Kellermeier (Chaoste) merged commit 01963df into main Apr 17, 2026
14 checks passed
@Chaoste Thomas Kellermeier (Chaoste) deleted the feat/bundler-module-resolution-support branch April 17, 2026 16:56
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