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

chore: use node: imports #2003

Merged
merged 2 commits into from
Jul 12, 2024
Merged

chore: use node: imports #2003

merged 2 commits into from
Jul 12, 2024

Conversation

Cangit
Copy link
Contributor

@Cangit Cangit commented Jul 10, 2024

(available since node 14.18)

@jsumners
Copy link
Member

I'm not clear what this offers. Will it result in issues from people bundling things?

@Cangit
Copy link
Contributor Author

Cangit commented Jul 11, 2024

There have been quite some discussions on the nodejs repo when the feature was introduced. Recently added modules don't have unprefixed versions available, like node:sqlite and node:test. Nodejs recommends the node: syntax for requiring core modules in the docs. Modern linters like biomejs have it on by default. It supports a more extensive standard library in JavaScript. It makes it clear for beginners that you are adding a Node.js builtin module. There are some microscopic cache(skip) benefits and security benefits.

If you are worried about deno and bun support (don't know if pino runs as is currently?) they handle the node: syntax fine. My understanding is that pinojs v9 only supports nodejs >=18, so its not breaking in that regard either.

Disclaimer: I am fully aware all of these reasons are opinionated and none are hard hitting. I do however feel obliged to suggest whatever nodejs proper/core brings out to help move the ecosystem forward.

@jsumners
Copy link
Member

Yes, all of that is true. I am asking what benefit it provides this code base. Any usage of modules that require the prefix will, of course, utilize the prefix. We know that people run this dependency, pino, through bundlers. So the big question is: will these changes cause issues with those things and result in complaints here?

@Cangit
Copy link
Contributor Author

Cangit commented Jul 11, 2024

Ah, sorry I misunderstood. I will do some research.

@Jarred-Sumner
Copy link

In Bun, node: prefixes are stripped and fully work without those

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@jsumners jsumners merged commit bd2fb33 into pinojs:main Jul 12, 2024
2 checks passed
@Cangit Cangit deleted the node-import branch July 12, 2024 12:59
@trentm
Copy link

trentm commented Jul 23, 2024

Just a data point: This indirectly breaks fastify@4 with Node.js v14 versions before 14.18.

@jsumners
Copy link
Member

Just a data point: This indirectly breaks fastify@4 with Node.js v14 versions before 14.18.

Nice. I suspected we'd see issues. We'll revert.

@trentm
Copy link

trentm commented Jul 23, 2024

We'll revert.

Please don't feel obliged just for me. I am able to cope in my usages. I just have some repos that try to maintain 14.17 as a min-supported Node. In my case I just needed to limit the scope of testing. My runtime deps haven't been broken.

@jsumners
Copy link
Member

I also forgot that this is in the v9 release line and we do not support v14 with pino@9:

| 9.x | 2024-04-26 | TBD | 18, 20, 22 |

@trentm
Copy link

trentm commented Jul 23, 2024

So, perhaps it is an issue on fastify@4 that it took a PR to bump its pino dep from 8 to 9? This PR (which was merged ... without any review?) fastify/fastify#5431

https://github.com/fastify/fastify/blob/4.x/docs/Reference/LTS.md#schedule

@jsumners
Copy link
Member

😖 I have feelings about Dependabot.

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.

5 participants