Skip to content

Remove tsup: build the static folders with rolldown and store with tsdown - #6091

Merged
Eugene (OEvgeny) merged 51 commits into
mainfrom
OEvgeny/feat-tsdown-remove-tsup
Nov 27, 2026
Merged

Eugene (OEvgeny) merged 51 commits into
mainfrom
OEvgeny/feat-tsdown-remove-tsup

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Last step of moving the build to tsdown, now that #6088 is merged: remove tsup.

Changelog Entry

Changed

  • Built the static/ folders with rolldown instead of esbuild, and removed tsup, in PR #6091, by @OEvgeny

Description

Only store still built with tsup, but tsup's base config and esbuild copies of our CSS plugins remained, and static/ of bundle and fluent-theme still built with esbuild. This pull request builds static/ with rolldown (same entries, exports and imports; fluent's CSS gains Lightning CSS's -webkit- prefixes for Safari 15) and removes tsup, esbuild plugins and options that only mirrored tsup.

Design

  • static/ builds call rolldown with our plugins: tsdown's defaults (cleaning, externals, declarations) do not fit static/; esbuild would need a copy of each CSS plugin.
  • No ignoreWatch or declaration map option: no script runs tsdown --watch, no tsconfig sets declarationMap.

Specific Changes

  • packages/store: tsdown, same exports and declarations
  • packages/{bundle,fluent-theme}/rolldown.static.mjs replace esbuild.static.mjs
  • Removed tsup.base.config.ts, esbuildPlugins.mjs, esbuildBabelPluginIstanbul.ts, esbuild injectCSSPlugin, tsup
  • injectCSSRolldownPlugin.ts: finds a chunk's entries via chunk.imports
  • injectCSSRolldownPlugin.spec.ts: source map test via @jridgewell/trace-mapping
  • tsdown.base.config.mts: comments say what options do, not "like tsup"
  • html2 boot/bundle.html and both fluentTheme/simple.html: expect tsdown
  • I have added tests and executed them locally
  • I have added .changelog/<PR#>-<slug>.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)

Eugene Olonov added 30 commits November 13, 2026 02:43
- tsdown 0.23.7 (rolldown 1.3.0, rolldown-plugin-dts 0.30.0), next to tsup.
- tsdown.base.config.mts: port of tsup.base.config.ts with createDualFormatConfigs(), iifeOptions() and packagePattern().
- rolldownPlugins.mjs: cssPlugin (CSS modules with the same Lightning CSS options, bundled per entry, lowered for the targets, with a source map) and istanbulPlugin (NODE_ENV=test).
- injectCSSRolldownPlugin: rolldown flavor of injectCSSPlugin, next to it.
api-graph, api-middleware, base, component-better-link, core, core-debug-api, core-graph, core-json-ld, directlinespeech, react-hooks, react-valibot, redux-store, styles and test/web-server.
No package of this step has CSS modules: cssPlugin, injectCSSRolldownPlugin and css: false come with api, component and fluent-theme. Also drop the metafile exclusion of directlinespeech, tsdown writes none.
- rolldownPlugins.mjs cssPlugin: CSS modules with the same Lightning CSS options, bundled per entry in esbuild's order, lowered for the targets per module, with a rule-level source map.
- injectCSSRolldownPlugin: rolldown flavor of injectCSSPlugin, next to it.
- tsdown.base.config.mts creates cssPlugin in the build:before hook, with the minify and target of the build being run: a config's own minify (e.g. a production.min IIFE in a development build) is honored, and configs that spread another config no longer share its state.
- @jridgewell/sourcemap-codec is now a root devDependency (rolldownPlugins.mjs imports it).
- Same entries, formats and placeholders as the tsup configs; fluent-theme's IIFE builds resolve React and Web Chat from the page with a rolldown umdResolvePlugin.

- sharedStylesRuntime.spec.js counts the copies of the styles runtime in the published scripts instead of reading esbuild metafiles, which tsdown does not write.

- addMetaTag specs expect buildTool "tsdown".
Minified CommonJS is no longer compressed: oxc prints `enumerable: !0` in re-export getters, which cjs-module-lexer (Node.js) does not match. component hook.js exposes 102/102 names again, like tsup; CommonJS is 4-5 % larger than compressed.
Minified CommonJS is no longer compressed: oxc prints `enumerable: !0` in re-export getters, which cjs-module-lexer (Node.js) does not match. Production CommonJS lists the same names as tsup again, for a few % more bytes than compressed.
- Same entries, formats, placeholders and dependency lists as the tsup configs.

- One IIFE config per script (webchat.js, webchat-es5.js, webchat-minimal.js, and the debug theme's development and production.min scripts), with iifeOptions() from the base config; rolldown cannot split an IIFE.

- debug-theme resolves React and Web Chat from the page with a rolldown umdResolvePlugin, like fluent-theme.
rolldown does not read the source maps of its inputs, so webchat.js.map pointed to the dist files of our packages instead of their TypeScript sources. inputSourceMapPlugin loads the input source map when a bundled file links one.
iifeOptions replaces the base outputOptions and the IIFE entries export
nothing, so esModule: false had no effect (IIFE outputs unchanged).
Lightning CSS returns the classes of a CSS module in random order (a Rust
HashMap; fixed upstream in parcel-bundler/lightningcss#1355, not released in
1.33.0), so two builds of the same tree wrote the class maps of component,
fluent-theme and bundle in different orders. Sort them by class name in the
rolldown and esbuild plugins; class names and CSS are unchanged.

The rolldown class map modules no longer carry a source map: their source
was the generated code with the absolute path of the built CSS.
rolldown-plugin-dts emits types re-exported from another package correctly, so the
rollup-plugin-dts workaround note no longer applies. The injected CSS lives in
static/botframework-webchat/chunk-*.js, which static/*.js did not match.
Keeps a single rolldown copy for dist (tsdown) and static/ builds.
rolldown-plugin-dts emits declarations module by module as they load and
TypeScript 6 prints union members in type creation order, so two clean builds
printed unions such as the core-graph schemas and injectStyleElementsPropsSchema
in a different order. stableTypeOrdering (hidden TypeScript 6.0 option, the
TypeScript 7 behavior) orders them by declaration position instead.
…downPlugin

The esbuild-like metafile and its graph code (relative-path fallback, external
imports) are not needed with rolldown's output bundle. Build output is
byte-identical except the plugin's own styles.build files.
Silences the 231 SOURCEMAP_BROKEN warnings of the tsdown and static builds.
rolldown already mapped the class map to no source, so the output is
byte-identical.
…ss-packages

Step 2 merged as #6071 (8f113e3). Conflicts:
- tsdown.base.config.mts: main's escape-string-regexp import, onlyBundle comment and packagePattern(), plus this branch's cssPlugin import, css: false, build:before hook and checks.
- rolldownPlugins.mjs: this branch's version (main's istanbulPlugin is unchanged).
- package-lock.json: main's, regenerated with npm install --package-lock-only.
Nothing reads them. The packages do not export <entry>.css: injectCSSRolldownPlugin injects it into the entry's
script, without a source map. `npm start` rebuilds with notify-build.sh and `build:run`, not `tsdown --watch`.

This removes concatCSS() and the root devDependency on @jridgewell/sourcemap-codec.
Since the class map is sorted in a transform hook, rolldown warned SOURCEMAP_BROKEN once per CSS module and build
(190 times in a full build). The class map is generated code, so its lines map to nothing, as before: the output,
source maps included, is byte-identical.
`moduleSideEffects: 'no-treeshake'` came from @tsdown/css. Our plugin finds the CSS of an entry through the module
graph (getModuleInfo().importedIds), not through the chunks, so it does not need the empty module in a chunk.
component and fluent-theme build byte-identical without it.
Eugene Olonov and others added 19 commits November 23, 2026 20:47
So CI runs it: the "Static code analysis" job runs the root `npm run precommit --if-present`.
The rolldown flavor of the CSS injection finds the placeholder as written
between quotes, so a placeholder with a backslash or a quote would never
be found and the CSS would not be injected. Only letters, digits, "_",
"@", "." and "-" are allowed now, which covers our placeholders.
…' into OEvgeny/feat-tsdown-iife-packages

Step 3 at 1d1225b (with main aef0722). One conflict, in the imports of
rolldownPlugins.mjs: step 3 dropped @jridgewell/sourcemap-codec and `relative`,
step 4 added readFile, dirname and resolve for inputSourceMapPlugin.
Replaces our inputSourceMapPlugin, which did the same thing by hand
(house preference 37: use the established package for a small utility).

rolldown ignores the `//# sourceMappingURL` of its inputs. The plugin
loads each bundled JavaScript file with its source map, so the maps point
to the original sources, as with esbuild. Compared with our plugin, it also
reads inline (`data:`) maps (react-scroll-to-bottom and
botframework-directlinejs now map to their `src`) and fills a missing
`sourcesContent` from disk (null entries in `webchat.js.map`: 263 -> 212,
the speech SDK's, whose sources are not published; tsup had the same 212).

Full dev build: all JavaScript, CSS and declarations byte-identical; 9 of
61 maps differ, only in those sources and contents. `include` is needed:
without it the plugin's `load` hook also loads the CSS modules
(`*.module.css?css_module`) before unplugin-lightningcss, and component
fails with 53 "Unknown class map format" errors.

The peer dependency rollup is already installed (dtsroll). The lockfile
adds the package and moves @rollup/pluginutils from 5.3.0 to 5.4.0.
rolldown-plugin-sourcemaps 0.1.2 (a rolldown fork, 2k weekly downloads)
gives byte-identical output; rollup-plugin-sourcemaps2 has 64k.
Bundle build time unchanged (6.0-6.4 s, 2 runs each).
- "Build IIFE before CJS/ESM to make npm start faster": tsdown starts every
  config of the array at once (`Promise.all` in buildWithConfigs), so the
  order does not change when a build starts. Removed.
- `uuid` in `deps.alwaysBundle`: rolldown, like esbuild, turns the speech
  SDK's `require("uuid")` into `__require("uuid")` when uuid is external
  (checked by building without it: `botframework-webchat.mjs` imports
  `__require` from the rolldown runtime), so the entry is still needed.
  The comment named only esbuild/tsup.
- `strict: true` in iifeOptions: say what it does (one "use strict" for
  the whole script) before why.
…down-remove-tsup

Conflicts:
- rolldownPlugins.mjs: the comment of the empty class map source map, taken from step 3.
- injectCSSRolldownPlugin.spec.ts: both specs kept (placeholder check and source map shift). The CSS asset of the
  source map scenario has no source map comment any more: cssPlugin no longer writes CSS source maps.
- package-lock.json: taken from the merged branch, then `npm install --package-lock-only`.

The merged branch replaced our inputSourceMapPlugin with rollup-plugin-sourcemaps2, which the static builds still
imported. inputSourceMapPlugin in rolldownPlugins.mjs now returns that plugin with the JavaScript-only filter, for the
tsdown and the static builds.
tsup and esbuild no longer build our packages, so "like tsup" and "like esbuild" stop
explaining anything. Each comment now says what the option does and why we need it.

The onlyBundle comment also lists what the CSS packages and bundle bundle: with the hint
turned on, api bundles handler-chain (imported, but not in its package.json), component and
the ESM/CommonJS builds of fluent-theme bundle no npm package, and bundle bundles its
alwaysBundle list.
rolldown-plugin-dts writes declaration maps only when `dts.sourcemap` or the tsconfig's
`declarationMap` is set, and tsdown does not pass its own `sourcemap` to it. None of our
tsconfig.json set `declarationMap`, so `false` was already the default.
ignoreWatch only applies to `tsdown --watch`. `npm start` watches with
scripts/npm/notify-build.sh, which reruns `npm run build:run` on each change, and no other
script runs `tsdown --watch`. The CSS plugin no longer registers watch files for the same reason.
The spec looked up original positions by hand: decode the mappings, then take the last
segment at or before the column. `originalPositionFor()` of @jridgewell/trace-mapping does
the same. It is a devDependency of styles now, at the version the tree already has (0.3.29,
dual CommonJS and ESM).

Without the column shift in the plugin, 2 of the 13 tests still fail.
…ife-packages

main at 909ec2a: step 3 as one squash (#6079), #6085 and #6053. One
conflict, packages/store/tsup.config.ts: git paired #6053's new file with the
packages/api/tsup.config.ts that step 3 deleted. Kept main's file; store still
builds with tsup.
…down-remove-tsup

No conflicts. The merged branch brings main's new packages/store, which still builds with tsup: the next commit moves
it to tsdown.
Same entry, exports and declarations as its tsup build. The tsup config set the module format build info, which store
does not read.
Brings #6088 as squashed on main (a96beab), with the same tree as its head 680de02, which this branch had
already merged. Conflicts in packages/bundle/package.json and tsdown.base.config.mts, where this branch changes
#6088's lines (rolldown.static.mjs, inputSourceMapPlugin): kept this branch's side, so the tree is unchanged.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The bundling, CSS, and declaration migrations require generated-artifact parity and browser compatibility validation unavailable in this dependency-free review environment.

No open issues 🎉

What changed in this PR

Completes the build migration following #6088: the store package moves to tsdown, and the bundle and Fluent theme’s static/ builds move to Rolldown.

Changes:

  • Replaces the remaining tsup build and both esbuild static-build scripts.
  • Consolidates CSS, source-map, and coverage plugins; removes obsolete configurations and dependencies.
  • Adds Rolldown CSS source-map tests and updates browser tests to expect tsdown build metadata.
File Description
tsup.base.config.ts Removes the shared tsup configuration.
tsdown.base.config.mts Reuses the source-map helper and removes obsolete options.
rolldownPlugins.mjs Shares input source-map handling and updates the coverage-config path.
packages/​vibe-grep/​src/​rules/​lightning-css.yaml Updates CSS validation comments and diagnostics to reference Rolldown.
packages/​tsconfig/​src/​legacy/​tsconfig.json Clarifies the retained deprecation-setting comment.
packages/​tsconfig/​src/​current/​tsconfig.json Removes the tsup-related deprecation setting.
packages/​test/​web-server/​tsdown.config.mts Clarifies the output-extension comment; no behavior change.
packages/​styles/​src/​build/​tsconfig.json Removes the tsup-related deprecation setting.
packages/​styles/​src/​build/​private/​injectCSSRolldownPlugin.ts Determines CSS ownership directly from chunk imports.
packages/​styles/​src/​build/​private/​injectCSSRolldownPlugin.spec.ts Tests source-map positions after CSS injection, including banners.
packages/​styles/​src/​build/​private/​injectCSSPlugin.ts Removes the esbuild CSS-injection plugin.
packages/​styles/​src/​build/​private/​injectCSSPlugin.spec.ts Removes the esbuild-specific injection tests.
packages/​styles/​src/​build/​index.ts Exports only the Rolldown plugin and its options type.
packages/​styles/​package.json Replaces esbuild with a source-map testing dependency.
packages/​store/​tsup.config.ts Removes the store’s tsup configuration.
packages/​store/​tsdown.config.mts Uses the shared dual-format tsdown configuration.
packages/​store/​package.json Switches the build command to tsdown.
packages/​fluent-theme/​rolldown.static.mjs Adds the Rolldown static build with CSS injection.
packages/​fluent-theme/​package.json Uses the new static script and adds Rolldown.
packages/​fluent-theme/​esbuild.static.mjs Removes the former esbuild static script.
packages/​component/​tsdown.config.mts Updates comments explaining entry CSS ownership.
packages/​bundle/​src/​boot/​exports/​minimal.ts Removes an obsolete declaration-generation warning comment.
packages/​bundle/​rolldown.static.mjs Builds static Web Chat and React entry points with Rolldown.
packages/​bundle/​package.json Switches static builds and expands nested-chunk CSS validation.
packages/​bundle/​esbuild.static.mjs Removes the former esbuild static script.
package.json Removes the root tsup dependency.
package-lock.json Synchronizes dependencies and removes tsup-only packages.
lightningCSSOptions.mjs Changes the JSDoc options type to the Rolldown adapter.
esbuildPlugins.mjs Removes the esbuild Lightning CSS adapter.
esbuildBabelPluginIstanbul.ts Removes the esbuild coverage-instrumentation adapter.
babelPluginIstanbul.config.json Provides the tool-neutral Babel coverage configuration.
.changelog/​6091-feat-tsdown-remove-tsup.md Records the static-build migration and tsup removal.
__tests__/​html2/​preact/​fluentTheme/​simple.html Requires tsdown metadata in the Preact Fluent theme test.
__tests__/​html2/​fluentTheme/​simple.html Requires tsdown metadata in the Fluent theme test.
__tests__/​html2/​boot/​bundle.html Requires tsdown metadata across bundle boot assertions.

Review effort: Balanced

@OEvgeny
Eugene (OEvgeny) merged commit 0ed4820 into main Nov 27, 2026
47 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/feat-tsdown-remove-tsup branch November 27, 2026 01:47
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.

3 participants