Skip to content

Unify and improve named exports#5588

Merged
compulim merged 46 commits intomainfrom
feat-rebundling
Sep 20, 2025
Merged

Unify and improve named exports#5588
compulim merged 46 commits intomainfrom
feat-rebundling

Conversation

@compulim
Copy link
Copy Markdown
Contributor

@compulim compulim commented Sep 19, 2025

Changelog Entry

Added

  • Improved bundling, in PR #5588, by @compulim
    • New named exports
      • api: botframework-webchat-api/hook
      • bundle: botframework-webchat/component, botframework-webchat/decorator (internal-use), botframework-webchat/hook
      • component: botframework-webchat-component/component, botframework-webchat-component/hook

Description

This PR pave the way to improve the bundling scenario for "fat" module: <script type="module">.

Design

/bundle/boot/

The folder has these designs in mind:

  • Less prone to bug due to missing exports on one format but available on another format
    • IIFE is based on CJS/ESM exports for consistencies
  • "Full" is enhancement of "minimal"
    • Cascading where possible: "full" re-exports "minimal" with overrides and adds

Implementation:

  • /actual/ contains building blocks
    • /actual/(component|hook)/(full|minimal) some blocks may have 2 flavors: full and minimal
      • Cascading fashion: full in based on minimal
  • /exports/ imports from /actual/ to form named exports
    • /exports/ do not exports minimal (because treeshaking should work), however, for convenience reasons, /exports/minimal do exists and is the base of /exports/index
    • For backward compatibility, /exports/index/ will export Components and hooks, they are imported from /exports/(component|hook)
  • /iife/ imports from /exports/ to form IIFE
    • /iife/webchat-es5 is based on /iife/webchat
    • However, /iife/webchat is not based on minimal
    • /iife/(webchat|webchat-minimal) is based on /exports/(index|minimal)

Specific Changes

  • Updated some import/export into re-export
  • Unified some packages to export from /boot/
  • Reinstall microsoft-cognitiveservices-speech-sdk@1.45.0, previous was picking up 1.17.0
  • api: Exported hooks via botframework-webchat-api/hook
  • bundle: Exported Components via botframework-webchat/component
  • bundle: Exported decorator via botframework-webchat/decorator
  • bundle: Exported hooks via botframework-webchat/hook
  • bundle: Cleaned up and unified /boot/ for IIFE and CJS/ESM
  • component: Exported Components via botframework-webchat-component/component
  • component: Exported hooks via botframework-webchat-component/hook
  • component: Fixed some typing issues in JS
    • AbsoluteTime, RelativeTime, UITracker, useForceRenderAtInterval, useNonce, BasicConnectivityStatus, BasicToaster
  • fluent-theme: Imported from botframework-webchat/decorator instead of botframework-webchat/internal when available
  • styles: Slightly better code splitting support
  • esbuild: Support outDirWithTemp for output folder other than dist
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Comment thread packages/api/package.json
Comment thread packages/component/tsup.config.ts
@compulim compulim marked this pull request as ready for review September 20, 2025 05:21
@compulim compulim changed the title [WIP] Rebundling (3rd attempt) Unify and improve named exports Sep 20, 2025
@compulim compulim merged commit e48fbd9 into main Sep 20, 2025
51 of 52 checks passed
@compulim compulim deleted the feat-rebundling branch September 20, 2025 07:00
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.

2 participants