Uh oh!
There was an error while loading. Please reload this page.
Upgrade the library build to Rollup 4 and TypeScript 5 - #2406
Merged
Conversation
These six travel together: rollup-plugin-dts 6 requires rollup ^3 || ^4, and its older 4.x line caps TypeScript below 5. rollup 2 -> 4, rollup-plugin-dts 4 -> 6, @rollup/plugin-terser 0.4 -> 1, @rollup/plugin-babel 6 -> 7, @rollup/plugin-node-resolve 13 -> 16, and typescript 4.9 -> 5.9. No build code changed. build-scripts.js was already using the plain Rollup JS API with the modern plugin packages, so the majors were drop-in. The published UMD bundles get substantially smaller. sky-nav.ts imports the generated token module for three values, and rollup 2 emitted all 97KB of it; rollup 4 tree-shakes the object down to the reachable leaves. cloudfour-patterns.js goes 116KB -> 21KB and .min.js 37KB -> 7.8KB, with the same seven exports. The ESM bundle is byte-for-byte identical, because terser's `module: true` pass was already doing this elimination -- only the UMD builds, which terser cannot treat as a module, were carrying the dead tokens. TypeScript 5.9 rather than the current 7. The constraint is not rollup-plugin-dts, which accepts ^4.5 || ^5 || ^6 || ^7, but @typescript-eslint -- held at 5.17 by @cloudfour/eslint-plugin, which peers on eslint 8. TypeScript 6 also removes `moduleResolution: "node"`, which tsconfig.json still uses, and 7 is the native compiler rewrite. Both belong with the lint upgrade, not here. Type declarations shift from `declare const` to `declare let` for namespace members inferred from JS object literals -- a TypeScript 5 declaration-emit change, and a widening, so no consumer breaks. Refs #2391
🦋 Changeset detectedLatest commit: eea840e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for cloudfour-patterns ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Uh oh!
There was an error while loading. Please reload this page.
Merged
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Upgrades the library build toolchain: rollup 2 → 4, rollup-plugin-dts 4 → 6,
@rollup/plugin-terser0.4 → 1,@rollup/plugin-babel6 → 7,@rollup/plugin-node-resolve13 → 16, and TypeScript 4.9 → 5.9. These six travel together — rollup-plugin-dts 6 requires rollup^3 || ^4, and its older 4.x line caps TypeScript below 5 — so splitting them further would leave the tree unresolvable.No build code changed.
gulpfile.js/tasks/build-scripts.jswas already using the plain Rollup JS API with the modern scoped plugin packages, so all six majors were drop-in. The diff is 12 lines ofpackage.jsonplus the lockfile.The published UMD bundles get substantially smaller.
sky-nav.tsimports the generated design-token module for three values, and rollup 2 emitted all 97KB of it. Rollup 4 tree-shakes the object literal down to the reachable leaves, sodist/cloudfour-patterns.jsdrops 116KB → 21KB anddist/cloudfour-patterns.min.js37KB → 7.8KB, with the same seven exports.dist/cloudfour-patterns.mjsis byte-for-byte identical, which explains the asymmetry: terser'smodule: truepass was already doing this elimination on the ESM output, so only the UMD builds — which terser cannot treat as a module — were carrying the dead tokens. There's a patch changeset for the size win.Decisions a reviewer might question
^4.5 || ^5 || ^6 || ^7, so it isn't the constraint.@typescript-eslintis: it's held at 5.17 by@cloudfour/eslint-plugin, which peers on ESLint 8. TypeScript 6 also removesmoduleResolution: "node", whichtsconfig.jsonstill uses, and 7 is the native compiler rewrite. Both belong with the lint upgrade rather than here. TypeScript 5.9 does not warn about that option, sotsconfig.jsonis untouched.@types/nodeoverride is not removed here.Dependency modernization: Node 24, Vite, and Storybook 10 #2391 lists that as part of this PR, but theoverridesblock only exists on Upgrade to Storybook 10 + Vite, and Twing 7 #2405's branch —mainhas no override, because webpack 4's dependency tree still pins@types/nodeto 12.20.6 there. It becomes a rebase step for whichever of the two PRs merges second. It will work in either order: TypeScript 5 parses@types/node26 fine, andskipLibCheckcovers the residualBuffer/Uint8Arraymismatches, since those are check errors rather than the parse errors TypeScript 4.9 hit.declare consttodeclare letfor namespace members inferred from JS object literals. That's a TypeScript 5 declaration-emit change, and a widening, so no consumer breaks. It's the only change indist/cloudfour-patterns.d.ts.This PR touches neither Storybook nor Twig, so it's independent of #2405. Both edit
package.jsonand the lockfile, so the second to merge will need a rebase.One thing noticed but deliberately left alone:
dist/cloudfour-patterns.d.tsexportsdefaultArgsanddefaultArgTypes, which come fromsrc/components/*/*-args.js— Storybook demo args leaking into the library's public types via the rollup entry glob. It's pre-existing onmainand the same class of bug #2405 fixed for.stories.js. Worth a follow-up on #2391 rather than widening this.Screenshots
Testing
CI covers lint, types, build, the test suite and
build-storybook. What it can't judge is whether the published artifacts are actually correct, so that's what's worth checking by hand.Run
npm run buildfirst, then:dist/cloudfour-patterns.jsis roughly 21KB anddist/cloudfour-patterns.min.jsroughly 7.8KB — both were several times larger before this changegrep -c 'exports\.' dist/cloudfour-patterns.jsshould report 7grep -o '40em\|0\.4s\|cubic-bezier(0\.455' dist/cloudfour-patterns.jsshould print all threegrep -c 'isSource' dist/cloudfour-patterns.jsshould report 0 (it was 172 before)dist/cloudfour-patterns.d.tsstill declares the same exports, now usingdeclare letinstead ofdeclare constinside thedefaultArgsnamespacedist/standalone.cssis unchanged at roughly 470KB — the Sass build is not affected by this PRThen check Sky Nav still works from the built bundle, since it's the component whose tokens were tree-shaken: