Vendicated / Vencord

The cutest Discord client mod
https://vencord.dev
GNU General Public License v3.0
7.97k stars 1.12k forks source link

chore: esbuild: ^0.15.18 → ^0.23.0 #2660

Open bb010g opened 3 weeks ago

bb010g commented 3 weeks ago

[!NOTE]
This PR is a patch stack. Do not squash these commits. This patch stack depends on:

I wanted to use RegExp literals using the v flag, but esbuild was too old. Whee.

The build scripts are first moved over to TypeScript (.mts) so upgrading with esbuild is sane. VS Code wouldn't show errors for the previous .mjs files for me, at least. tsc will catch future type errors now. (I can split this out to a separate PR if you really want.)

esbuild is then moved forward one breaking release at a time, to make both authoring and reviewing easier.

esbuild v0.16 doesn't break us.

esbuild v0.17 breaks our use of esbuild.build({ watch: true }), so that's all refactored to support the new context design and recommended logging setup. We now log our own summaries & errors, but esbuild can still do so with pnpm run build --summary. Care has been taken to prevent logs from separate builds from overlapping. (This delays builds slightly, esp. when --summary is passed, but it's worth it for useful output.) I'd really like to instruct esbuild to call a JavaScript callback whenever it logs. Related issues:

esbuild v0.18 breaks our type signatures slightly.

esbuild v0.19 doesn't break us.

esbuild v0.20 doesn't break us.

esbuild v0.21 doesn't break us.

esbuild v0.22 breaks our use of --platform=node defaults, switching from --packages=bundle to --packages=external.

esbuild v0.23 switches --platform=node defaults back to --packages=bundle, but I kept our explicit declaration.

Each commit passed pnpm install && pnpm run lint && pnpm run lint-styles && pnpm run testTsc && pnpm run build --dev on my machine.

https://github.com/Vendicated/Vencord/pull/2446 also upgrades esbuild to ^0.21.5, but the output handling is less robust and I generally think the approach here is cleaner.