Skip to content

refactor: use tsdown instead of tsc - #154

Merged
RedStar071 merged 8 commits into
mainfrom
refactor/use-tsdown-instead-of-tsc
Dec 12, 2025
Merged

RedStar071 merged 8 commits into
mainfrom
refactor/use-tsdown-instead-of-tsc

Conversation

@RedStar071

@RedStar071 RedStar071 commented Dec 10, 2025 •

Copy link
Copy Markdown
Member

This pull request modernizes the build and module system for the project by switching to ESM .mjs outputs, replacing the TypeScript build process with tsdown, and introducing a custom tsdown.config.ts for 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:

  • Changed all output and import map references in package.json from .js to .mjs to fully adopt ESM throughout the project. Updated the "main" entry and script commands to use .mjs files.
  • Replaced the TypeScript build process (tsc and tsc-watch) with tsdown, updating all relevant scripts and adding tsdown as a dev dependency. [1] [2]

Build configuration and automation:

  • Added a new tsdown.config.ts file that:
    • Provides custom plugins to resolve import maps (e.g., #lib, #utils) during the build.
    • Automates copying of .mjs worker files and the languages directory from src to dist after build completion.
  • Updated tsconfig.eslint.json to include the new build config file for linting.

Dependency and packaging management:

  • Enhanced the package.json pnpm configuration to specify allowed deprecated versions, expanded onlyBuiltDependencies, and introduced ignoredBuiltDependencies for 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-watch to tsdown, 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

  • Replaced all build-related scripts in package.json to use tsdown instead of tsc and tsc-watch, simplifying build, development, and watch commands.
  • Added tsdown as a dependency and removed tsc-watch from package.json.
  • Added a new tsdown.config.ts file with custom plugins for import map resolution and copying .mjs worker files, as well as detailed build options tailored for the project.
  • Updated tsconfig.eslint.json to include the new tsdown.config.ts file for linting and type checking.

Dependency and Build Output Management

  • Updated the package.json pnpm configuration to specify allowed deprecated versions, refine built dependencies, and ignore certain dependencies during build for improved control and reliability.

Summary by CodeRabbit

Chores

  • Updated the project's build tooling and dependencies
  • Enhanced build configuration for improved build workflow

✏️ Tip: You can customize this high-level summary in your review settings.

@RedStar071 RedStar071 self-assigned this Dec 10, 2025
Copilot AI review requested due to automatic review settings December 10, 2025 09:03
Comment thread package.json Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-watch with tsdown across all build scripts
  • Added custom plugins for import map resolution (#lib, #utils, #root, #languages) and copying .mjs worker 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.

Comment thread tsdown.config.ts Resolved
Comment thread package.json Resolved
coderabbitai[bot]

This comment was marked as duplicate.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread tsdown.config.ts Resolved
@RedStar071
RedStar071 enabled auto-merge December 12, 2025 13:00
@RedStar071
RedStar071 disabled auto-merge December 12, 2025 13:02
@RedStar071
RedStar071 requested a review from Copilot December 12, 2025 13:02
@RedStar071
RedStar071 enabled auto-merge December 12, 2025 13:04
@RedStar071
RedStar071 merged commit 24a6377 into main Dec 12, 2025
@RedStar071
RedStar071 deleted the refactor/use-tsdown-instead-of-tsc branch December 12, 2025 13:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +58 to +65
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);

Copilot AI Dec 12, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
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)
);

Copilot uses AI. Check for mistakes.
@github-project-automation github-project-automation Bot moved this to Done in Wolfstar Jan 13, 2026
@RedStar071 RedStar071 added this to the v2 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants