Skip to content

unpack: Move fromFile to fs entry point#250

Merged
michaeltaranto merged 3 commits intomasterfrom
unpack-server-entry
Dec 18, 2025
Merged

unpack: Move fromFile to fs entry point#250
michaeltaranto merged 3 commits intomasterfrom
unpack-server-entry

Conversation

@michaeltaranto
Copy link
Copy Markdown
Contributor

@michaeltaranto michaeltaranto commented Dec 15, 2025

Create fs entry point to isolate usage of file system APIs without needing to polyfill.

BREAKING CHANGES

Move fromFile to fs entry point.

MIGRATION GUIDE

-import { fromFile } from '@capsizecss/unpack';
+import { fromFile } from '@capsizecss/unpack/fs';

As an aside, noticed the lint wasn't being run in CI 🤦‍♂️ .

@michaeltaranto michaeltaranto requested a review from a team as a code owner December 15, 2025 00:48
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 15, 2025

🦋 Changeset detected

Latest commit: e590041

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@capsizecss/unpack Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@michaeltaranto michaeltaranto mentioned this pull request Dec 15, 2025
Copy link
Copy Markdown
Contributor

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Looks good! My only thoughts:

  • @capsizecss/unpack/node could be another naming option vs /server

  • The other alternative would be to drop fromFile() entirely and tell people to migrate to:

    fromBuffer(await readFile('my-font.ttf'))

    Then there would be no need to worry about the module’s compatibility. But I get that it can be handy to have a dedicated API.

@michaeltaranto
Copy link
Copy Markdown
Contributor Author

Yeah the naming for the import path was something I wasnt sold on. Even node sounds a bit odd. Have you seen this convention in other packages?

I think its a good convenience to provide, so i guess just bike-shedding the naming is the last step here.

@delucis
Copy link
Copy Markdown
Contributor

delucis commented Dec 16, 2025

Have you seen this convention in other packages?

I feel like I have, but now I can’t find any examples 😅 (In fact, maybe I’m even just thinking of myself — at one point I played with having a smaller @fontkitten/node package, but once I realised Capsize needed browser support, I dropped the idea because my main target was improving things specifically for Capsize and the downstream web frameworks like Astro & Nuxt.)

Either way, I’m not too fussed about the naming! Happy to see whichever makes sense to you.

@michaeltaranto
Copy link
Copy Markdown
Contributor Author

Playing around with some very honest paths:

import { fromFile } from '@capsizecss/unpack/file-system';

or

import { fromFile } from '@capsizecss/unpack/fs';

Thoughts?

@delucis
Copy link
Copy Markdown
Contributor

delucis commented Dec 17, 2025

Oh yeah, fs like Node does could make sense! And it’s very explicit about the API being a file API (which is what it is) vs. “server” which suggests maybe it handles requests or whatever.

@michaeltaranto michaeltaranto changed the title unpack: Move fromFile to server entry point unpack: Move fromFile to fs entry point Dec 17, 2025
@michaeltaranto michaeltaranto merged commit 31dc6fa into master Dec 18, 2025
6 checks passed
@michaeltaranto michaeltaranto deleted the unpack-server-entry branch December 18, 2025 22:58
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