Repository navigation
refactor: use tsdown instead of tsc - #154
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces the TypeScript compilation toolchain from tsc/tsc-watch to tsdown, introducing a custom build configuration with plugins for import map resolution and asset copying. The migration aims to modernize the build system while maintaining the existing project structure and output format.
Key Changes:
- Replaced
tsc/tsc-watchwithtsdownacross all build scripts - Added custom plugins for import map resolution (
#lib,#utils,#root,#languages) and copying.mjsworker files - Enhanced pnpm configuration with deprecated version allowances and refined build dependency management
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tsdown.config.ts | New configuration file defining tsdown build settings, custom import resolution plugin, and worker file copying plugin |
| tsconfig.eslint.json | Added tsdown.config.ts to ESLint's type checking scope |
| package.json | Updated build scripts to use tsdown commands, replaced tsc-watch dependency with tsdown, and expanded pnpm configuration for build dependencies |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ions for ESM compatibility
…ove emoji validation logic
…Vitest configuration
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const codepoints = [...emoji]; | ||
|
|
||
| if (codepoints.length !== 1) return false; | ||
|
|
||
| const code = emoji.codePointAt(0); | ||
| if (code === undefined) return false; | ||
|
|
||
| return allowedTwemojiRanges.some(([start, end]) => code >= start && code <= end); |
There was a problem hiding this comment.
The matchesTwemoji function only accepts single-codepoint emojis (line 60 checks codepoints.length !== 1), but many valid emojis are composed of multiple codepoints (e.g., emoji with skin tone modifiers like "👋🏻", flag emojis like "🇺🇸", or ZWJ sequences like "👨👩👧"). This will incorrectly reject these valid twemojis. Consider removing or adjusting the length check to handle multi-codepoint sequences properly, or check all codepoints in the emoji rather than just the first one.
| const codepoints = [...emoji]; | |
| if (codepoints.length !== 1) return false; | |
| const code = emoji.codePointAt(0); | |
| if (code === undefined) return false; | |
| return allowedTwemojiRanges.some(([start, end]) => code >= start && code <= end); | |
| const codepoints = [...emoji].map((point) => point.codePointAt(0)); | |
| if (codepoints.some((code) => code === undefined)) return false; | |
| return codepoints.every((code) => | |
| allowedTwemojiRanges.some(([start, end]) => code! >= start && code! <= end) | |
| ); |
This pull request modernizes the build and module system for the project by switching to ESM
.mjsoutputs, replacing the TypeScript build process withtsdown, and introducing a customtsdown.config.tsfor advanced build customization. The changes ensure better compatibility with ESM, streamline import map resolution, and automate copying of necessary files during the build.Build system and ESM migration:
package.jsonfrom.jsto.mjsto fully adopt ESM throughout the project. Updated the"main"entry and script commands to use.mjsfiles.tscandtsc-watch) withtsdown, updating all relevant scripts and addingtsdownas a dev dependency. [1] [2]Build configuration and automation:
tsdown.config.tsfile that:#lib,#utils) during the build..mjsworker files and thelanguagesdirectory fromsrctodistafter build completion.tsconfig.eslint.jsonto include the new build config file for linting.Dependency and packaging management:
package.jsonpnpmconfiguration to specify allowed deprecated versions, expandedonlyBuiltDependencies, and introducedignoredBuiltDependenciesfor more precise dependency handling.These changes collectively improve the maintainability, modularity, and deployment readiness of the project for ESM environments.This pull request migrates the project's build system from
tsc/tsc-watchtotsdown, introducing a custom configuration and plugins to improve TypeScript compilation and output handling. The most important changes are grouped below:Build System Migration and Configuration
package.jsonto usetsdowninstead oftscandtsc-watch, simplifying build, development, and watch commands.tsdownas a dependency and removedtsc-watchfrompackage.json.tsdown.config.tsfile with custom plugins for import map resolution and copying.mjsworker files, as well as detailed build options tailored for the project.tsconfig.eslint.jsonto include the newtsdown.config.tsfile for linting and type checking.Dependency and Build Output Management
package.jsonpnpmconfiguration to specify allowed deprecated versions, refine built dependencies, and ignore certain dependencies during build for improved control and reliability.Summary by CodeRabbit
Chores
✏️ Tip: You can customize this high-level summary in your review settings.