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

A few ideas #21

Open
2 tasks done
antfu opened this issue Sep 5, 2023 · 0 comments
Open
2 tasks done

A few ideas #21

antfu opened this issue Sep 5, 2023 · 0 comments

Comments

@antfu
Copy link
Collaborator

antfu commented Sep 5, 2023

First, this is a very interesting idea, and I see a lot of potential in it that would benefit the entire Node ecosystem. Here I have a few suggestions that just came out of my mind, that I think might help the community to grow.

Code Orangizing Wise

  • It might be better to separate the packages/ into two directories, for example, /packages and /nolyfills to separate the source of tooling like /packages/cli and the generated packages. This would help contributors to understand the structure and contribute more easily. - refactor: reorganize packages #22
  • It would be better if the versions of each package were standalone and bumped only when needed. Since a lot of them are simple packages that aren't going to change often. So usually, ppl don't have to update every nolyfills every time you do the release. I imagine this can be done by the script easily - feat: standalone version for each package #23
  • Maybe there would be a better format than the current create.cjs, as the indentation is off and there is no syntax highlight. I consider it might be hard to maintain in the long term.
    • Maybe a huge .cjs file that is separated with magic comments. This way, we could also utilize formatters and linters to help maintain them.

For the points listed above, I am happy to help and send PRs if you think they are good ideas.

Feature Wise

  • To me, I think the ultimate solution for such "one-line packages" situation would be to avoid those packages at all. A few immature ideas
    • For pnpm, we may use the .pnpmfile.cjs manipulate the dependents from the database in [Feature Request] Programmatic usage (JavaScript SDK) #20
    • Maybe we could dynamically replace the require('xxx') from the dependent and generate patches atomically
    • If there are community-made "modern rewrite" (for rather more complex projects), maybe they can be included (or extensible) in the nolyfill database and replaced together while leaving the complexity outside of nolyfill
  • It would be nice to print which packages are relying on the packages we patched, similar to pnpm -r why xxx but with a more unified display and programmatic APIs
  • With the SDK/DB, I guess we might also have a build plugin. So that the build tools can throw warning when those packages get detected, and auto patch it in the build (even with ESM directly?), so they could also help with the frontend bundles
    • Fetch data directly from CDN

I am looking forward to contributing and seeing the community grow. I will try to update this issue whenever I have new ideas.

@antfu antfu changed the title A few suggestions A few ides Sep 5, 2023
@antfu antfu changed the title A few ides A few ideas Sep 5, 2023
antfu added a commit to antfu/nolyfill that referenced this issue Sep 5, 2023
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

No branches or pull requests

1 participant