Skip to content
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

Use bunchee as bundler #276

Merged
merged 4 commits into from
Dec 28, 2023
Merged

Use bunchee as bundler #276

merged 4 commits into from
Dec 28, 2023

Conversation

huozhi
Copy link
Contributor

@huozhi huozhi commented Dec 27, 2023

Switch bundler to bunchee (4.2.x)

For typescript, if you're using .mjs or .cjs, node16 module resolving will require your type file matched the bundle file. Which requires to have .d.mts or .d.cts as type files. bunchee could handle help you generate them without configuration.

  • Update the package.json to have both declaration files for ESM and CJS bundles.
  • Switching bundler from tsup to bunchee

PR Changes

Types Validation

Below are the testing results comparing between "Before migration (using tsup)" and "After migration (using bunchee)". Tested with @arethetypeswrong/cli

┌───────────────────┬──────────┐
│                   │ "sonner" │
├───────────────────┼──────────┤
│ node10            │ 🟢       │
├───────────────────┼──────────┤
│ node16 (from CJS) │ 🟢 (CJS) │
├───────────────────┼──────────┤
│ node16 (from ESM) │ 🟢 (ESM) │
├───────────────────┼──────────┤
│ bundler           │ 🟢       │
└───────────────────┴──────────┘

Before

┌───────────────────┬────────────────────────┐
│                   │ "sonner"               │
├───────────────────┼────────────────────────┤
│ node10            │ 🟢                     │
├───────────────────┼────────────────────────┤
│ node16 (from CJS) │ 🟢 (CJS)               │
├───────────────────┼────────────────────────┤
│ node16 (from ESM) │ 🎭 Masquerading as CJS │
├───────────────────┼────────────────────────┤
│ bundler           │ 🟢                     │
└───────────────────┴────────────────────────┘

Assets

Now we don't need to apply minification for the lib bundles anymore, when it's adopted to app like Next.js, the app bundler will minify it.

The minification result are actually the same, if you run bunchee -m you'll see this, and below is the result comparing to before

After

   [types] dist/index.d.mts  - 3.77 kB
   [types] dist/index.d.ts   - 3.77 kB
   [chunk] dist/index.mjs    - 26.8 kB
   [chunk] dist/index.js     - 27.4 kB

Before

CJS dist/index.js     26.95 KB
CJS dist/index.js.map 61.29 KB
ESM dist/index.mjs     25.77 KB
ESM dist/index.mjs.map 60.81 KB
DTS dist/index.d.ts 3.67 KB

Copy link

vercel bot commented Dec 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 28, 2023 0:48am

@emilkowalski emilkowalski merged commit 21cd8a8 into emilkowalski:main Dec 28, 2023
3 checks passed
@huozhi huozhi deleted the bundler branch December 28, 2023 00:53
SHABIN-K referenced this pull request in SHABIN-K/Brainwave Jan 30, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [sonner](https://sonner.emilkowal.ski/)
([source](https://github.com/emilkowalski/sonner)) | [`1.3.1` ->
`1.4.0`](https://renovatebot.com/diffs/npm/sonner/1.3.1/1.4.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/sonner/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/sonner/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/sonner/1.3.1/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/sonner/1.3.1/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>emilkowalski/sonner (sonner)</summary>

###
[`v1.4.0`](https://github.com/emilkowalski/sonner/releases/tag/v1.4.0)

[Compare
Source](https://github.com/emilkowalski/sonner/compare/c449e2741368b04b4524859aa2a60696c0cfb58c...v1.4.0)

#### What's Changed

- Use bunchee as bundler by
[@&#8203;huozhi](https://github.com/huozhi) in
[https://github.com/emilkowalski/sonner/pull/276](https://github.com/emilkowalski/sonner/pull/276)
- build: bump bundler for perf purpose by
[@&#8203;huozhi](https://github.com/huozhi) in
[https://github.com/emilkowalski/sonner/pull/277](https://github.com/emilkowalski/sonner/pull/277)
- Fix light theme on homepage by
[@&#8203;emilkowalski](https://github.com/emilkowalski) in
[https://github.com/emilkowalski/sonner/pull/281](https://github.com/emilkowalski/sonner/pull/281)
- feat: `description` support function in promise by
[@&#8203;kahosan](https://github.com/kahosan) in
[https://github.com/emilkowalski/sonner/pull/279](https://github.com/emilkowalski/sonner/pull/279)
- add PR and issue templates by
[@&#8203;choeqq](https://github.com/choeqq) in
[https://github.com/emilkowalski/sonner/pull/286](https://github.com/emilkowalski/sonner/pull/286)
- refactor: remove unused remaining time ref by
[@&#8203;wobsoriano](https://github.com/wobsoriano) in
[https://github.com/emilkowalski/sonner/pull/284](https://github.com/emilkowalski/sonner/pull/284)
- types: change label types to ReactNode by
[@&#8203;CanRau](https://github.com/CanRau) in
[https://github.com/emilkowalski/sonner/pull/280](https://github.com/emilkowalski/sonner/pull/280)
- feat: add `icons` prop to `<Toaster />` by
[@&#8203;amirhhashemi](https://github.com/amirhhashemi) in
[https://github.com/emilkowalski/sonner/pull/270](https://github.com/emilkowalski/sonner/pull/270)
- Fix types of toaster icons by
[@&#8203;emilkowalski](https://github.com/emilkowalski) in
[https://github.com/emilkowalski/sonner/pull/294](https://github.com/emilkowalski/sonner/pull/294)
- Fix loading icon bug by
[@&#8203;emilkowalski](https://github.com/emilkowalski) in
[https://github.com/emilkowalski/sonner/pull/295](https://github.com/emilkowalski/sonner/pull/295)
- Add close button prop to toast by
[@&#8203;emilkowalski](https://github.com/emilkowalski) in
[https://github.com/emilkowalski/sonner/pull/296](https://github.com/emilkowalski/sonner/pull/296)
- Swap bundlers by
[@&#8203;emilkowalski](https://github.com/emilkowalski) in
[https://github.com/emilkowalski/sonner/pull/297](https://github.com/emilkowalski/sonner/pull/297)
- Dont dismiss loading toast by
[@&#8203;emilkowalski](https://github.com/emilkowalski) in
[https://github.com/emilkowalski/sonner/pull/298](https://github.com/emilkowalski/sonner/pull/298)
- Upgrade bunchee for bundling bug fixes by
[@&#8203;huozhi](https://github.com/huozhi) in
[https://github.com/emilkowalski/sonner/pull/299](https://github.com/emilkowalski/sonner/pull/299)
- bump packages by [@&#8203;choeqq](https://github.com/choeqq) in
[https://github.com/emilkowalski/sonner/pull/283](https://github.com/emilkowalski/sonner/pull/283)
- chore: remove unused npm lock file by
[@&#8203;huozhi](https://github.com/huozhi) in
[https://github.com/emilkowalski/sonner/pull/300](https://github.com/emilkowalski/sonner/pull/300)
- fix: make closeButton option in toast take precedence over Toaster by
[@&#8203;jzxhuang](https://github.com/jzxhuang) in
[https://github.com/emilkowalski/sonner/pull/309](https://github.com/emilkowalski/sonner/pull/309)
- Renaming too general className with project-specific one
([#&#8203;305](https://github.com/emilkowalski/sonner/issues/305)) by
[@&#8203;jschoder](https://github.com/jschoder) in
[https://github.com/emilkowalski/sonner/pull/315](https://github.com/emilkowalski/sonner/pull/315)
- ghost-div doesn't block click in Firefox by
[@&#8203;jschoder](https://github.com/jschoder) in
[https://github.com/emilkowalski/sonner/pull/307](https://github.com/emilkowalski/sonner/pull/307)
- Avoid issues with `<li>` offest when using different positions by
[@&#8203;mmalomo](https://github.com/mmalomo) in
[https://github.com/emilkowalski/sonner/pull/314](https://github.com/emilkowalski/sonner/pull/314)
- Implement option to pause when document is hidden by
[@&#8203;etcd](https://github.com/etcd) in
[https://github.com/emilkowalski/sonner/pull/304](https://github.com/emilkowalski/sonner/pull/304)
- Update bundler by
[@&#8203;emilkowalski](https://github.com/emilkowalski) in
[https://github.com/emilkowalski/sonner/pull/317](https://github.com/emilkowalski/sonner/pull/317)

#### New Contributors

- [@&#8203;kahosan](https://github.com/kahosan) made their first
contribution in
[https://github.com/emilkowalski/sonner/pull/279](https://github.com/emilkowalski/sonner/pull/279)
- [@&#8203;choeqq](https://github.com/choeqq) made their first
contribution in
[https://github.com/emilkowalski/sonner/pull/286](https://github.com/emilkowalski/sonner/pull/286)
- [@&#8203;CanRau](https://github.com/CanRau) made their first
contribution in
[https://github.com/emilkowalski/sonner/pull/280](https://github.com/emilkowalski/sonner/pull/280)
- [@&#8203;amirhhashemi](https://github.com/amirhhashemi) made their
first contribution in
[https://github.com/emilkowalski/sonner/pull/270](https://github.com/emilkowalski/sonner/pull/270)
- [@&#8203;jzxhuang](https://github.com/jzxhuang) made their first
contribution in
[https://github.com/emilkowalski/sonner/pull/309](https://github.com/emilkowalski/sonner/pull/309)
- [@&#8203;jschoder](https://github.com/jschoder) made their first
contribution in
[https://github.com/emilkowalski/sonner/pull/315](https://github.com/emilkowalski/sonner/pull/315)
- [@&#8203;mmalomo](https://github.com/mmalomo) made their first
contribution in
[https://github.com/emilkowalski/sonner/pull/314](https://github.com/emilkowalski/sonner/pull/314)
- [@&#8203;etcd](https://github.com/etcd) made their first
contribution in
[https://github.com/emilkowalski/sonner/pull/304](https://github.com/emilkowalski/sonner/pull/304)

**Full Changelog**:
emilkowalski/sonner@v1.3.0...v1.4.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/SHABIN-K/toss).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE1My4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->
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.

2 participants