Skip to content

(deps) Replace pascal-case with change-case (Maintained & Lighter) #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jycouet
Copy link

@jycouet jycouet commented Mar 8, 2025

This PR replaces the unmaintained pascal-case package with its recommended successor, change-case.

Why?

  • [email protected] is outdated, and 4.0.0 is deprecated.
  • The author suggests migrating to change-case.
  • change-case has 0 dependencies and a smaller total footprint.

Comparison:

Package Size Dependencies Total Size
pascal-case 14KB 2 (no-case 25KB, lower-case 17KB) 56KB
change-case 35KB 0 35KB

Net win: Fewer dependencies, lower size, and a more future-proof solution.

@jycouet
Copy link
Author

jycouet commented Mar 8, 2025

Seemed simple and easy, of course working locally!
I don't know what's wrong there :o :/

@jasonlyu123
Copy link
Member

jasonlyu123 commented Mar 8, 2025

The CI is probably broken because the default environment has changed. It probably failed in the master branch, too. I'll try to fix it later.

@jycouet
Copy link
Author

jycouet commented Mar 8, 2025

Hooo okay.
Thank you for the info 👍

@jasonlyu123
Copy link
Member

jasonlyu123 commented Mar 10, 2025

Weird... The problem is because change-case is an ESM libary. For some odd reason, the test breaks as long as you import any ESM libary. It probably has something to do with the loader API mocha depends on to run TypeScript tests.

@jycouet
Copy link
Author

jycouet commented Mar 10, 2025

I'm willing to work on this if you are ok with it :)

@jasonlyu123
Copy link
Member

Sure. I haven't figure out a solution or found a upstream issue yet.

@jycouet
Copy link
Author

jycouet commented Mar 10, 2025

I'm turning and turning and turning, but can't find a solution!
Locally, I don't get the error, you manage to have it ?
You think it's a mocha issue only ? Or the esm/cjs issue will happen also for consumer ?
There is a reason for svelte2tsx to be "type": commonjs ?

@dummdidumm
Copy link
Member

FWIW we have a "would be nice" ticket to migrate from mocha to vitest (#2031), maybe that solves that issue (but it obviously is quite the undertaking)

@jycouet
Copy link
Author

jycouet commented Mar 10, 2025

Let's see tomorrow if I can start something. 🫠

@jycouet jycouet mentioned this pull request Mar 11, 2025
@dummdidumm
Copy link
Member

Mhhhm can we do this just yet? change-case is ESM only, and svelte2tsx still supports CJS. The flag in node that makes it possible to use ESM through require is still quite new so not everyone will have it.

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