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

Replace qs with zero-dependency & Typesafe neoqs #65

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mattstrayer
Copy link

PR inspired by the es tooling ecosystem cleanup initiative on github https://github.com/es-tooling/ecosystem-cleanup

zero-dep, typescript safe alternative to qs

https://deptree.rschristian.dev/?q=qs
https://deptree.rschristian.dev/?q=neoqs

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

  • Replaced 1:1 package with typesafe & zero dep alternative

zero-dep, typescript safe alternative to qs
@mattstrayer
Copy link
Author

mattstrayer commented Aug 8, 2024

Can also open up a similar pr for lucid as well if y'all would like!

Updated: adonisjs/lucid#1048

@@ -9,7 +9,8 @@

import raw from 'raw-body'
import inflate from 'inflation'
import qs, { IParseOptions } from 'qs'
import * as qs from 'neoqs'
Copy link

Choose a reason for hiding this comment

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

Just in case bodyparser still ships with CJS, this should be neoqs/legacy

Copy link
Author

Choose a reason for hiding this comment

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

with v6 of adonis they migrated entirely to ESM!

Thanks for your work on neoqs and appreciate you getting involved here :)

Copy link

Choose a reason for hiding this comment

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

Great!! Thanks a lot for this PR

Heads up, I'm working on neoqs/modern, which will cut the bundle size from 3.9kb to 3.4kb, by removing all the option invalidation logic, which can be done by typescript entirely. I will then add a PR to switch to that, dropping the size even more

Choose a reason for hiding this comment

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

Can we actually get away with just URLSearchParams or node:querystring ?

Copy link
Author

Choose a reason for hiding this comment

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

depending on the engines that adonis aims to support, I think that's an option as well!

Copy link
Member

@RomainLanz RomainLanz Aug 12, 2024

Choose a reason for hiding this comment

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

Can we actually get away with just URLSearchParams or node:querystring ?

No, we cannot, qs and neoqs supports nested object syntax, whereas the node:querystring module does not.

@RomainLanz
Copy link
Member

Thanks for your PR!

We discussed this internally, and we would prefer not to migrate to neoqs as of now. But we keep the PR open for further discussion.

The main reason is that qs is a critical part of AdonisJS, and this new package may not fit all use cases or keep up with the qs package.

Also, migrating to a brand new package may add more vulnerability since we don't know well the author nor its future intention.

If we want to debloat qs, we would prefer to make our own version under the BoringNode organization.

Related PRs are:

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.

4 participants