Skip to content

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

Closed
jycouet wants to merge 3 commits into
sveltejs:masterfrom
jycouet:deps/replace-pascal-case-with-change-case
Closed

jycouet wants to merge 3 commits into
sveltejs:masterfrom
jycouet:deps/replace-pascal-case-with-change-case

Conversation

@jycouet

@jycouet jycouet commented Mar 8, 2025

Copy link
Copy Markdown
Contributor

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

Why?

  • pascal-case@3.1.1 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

jycouet commented Mar 8, 2025

Copy link
Copy Markdown
Contributor Author

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

@jasonlyu123

jasonlyu123 commented Mar 8, 2025 •

Copy link
Copy Markdown
Member

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

jycouet commented Mar 8, 2025

Copy link
Copy Markdown
Contributor Author

Hooo okay.
Thank you for the info 👍

@jasonlyu123

jasonlyu123 commented Mar 10, 2025 •

Copy link
Copy Markdown
Member

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

jycouet commented Mar 10, 2025

Copy link
Copy Markdown
Contributor Author

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

@jasonlyu123

Copy link
Copy Markdown
Member

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

@jycouet

jycouet commented Mar 10, 2025

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

jycouet commented Mar 10, 2025

Copy link
Copy Markdown
Contributor Author

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

@jycouet jycouet mentioned this pull request Mar 11, 2025
@dummdidumm

Copy link
Copy Markdown
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.

@jycouet

jycouet commented Sep 9, 2025

Copy link
Copy Markdown
Contributor Author

Close in favor of #2842

@jycouet jycouet closed this Sep 9, 2025
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