10000 Docs: "server-only" package is referenced, but not documented · Issue #71071 · vercel/next.js · GitHub
[go: up one dir, main page]

Skip to content

Docs: "server-only" package is referenced, but not documented #71071

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

Open
petetnt opened this issue Oct 10, 2024 · 7 comments
Open

Docs: "server-only" package is referenced, but not documented #71071

petetnt opened this issue Oct 10, 2024 · 7 comments

Comments

@petetnt
Copy link
petetnt commented Oct 10, 2024

What is the documentation issue?

Package server-only has no documentation and it's hard to say if it's a official package, or unofficial one, or recommended one. It's also very hard to say where it's sourced from without extensive detective work. It's being used both in NextJS docs as well as react.dev documentation.

The package should be documented, most likely owned one of the orgs and the source should be clearly available.

Is there any context that might help us understand?

This issue is about general confusion about server-only package.

Everything probably starts somewhere around https://github.com/reactjs/rfcs/blob/main/text/0227-server-module-conventions.md where Ryo and Dan have a propsal around server-module-conventions. It describes poisoning imports using a package.

At the same time, https://www.npmjs.com/package/server-only/v/0.0.1 is published to npm by @sebmarkbage , that contains absolutely no documentation and points to reactjs.org, making it seem that it's somehow related to React itself, despite not living under any Meta related namespace.

There's two usages of the package documented very loosely on the internet, first one can be found in the NextJS docs that clearly says that "install this package, use it like this", and it's probably fine: https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#keeping-server-only-code-out-of-the-client-environment

Closest thing to the source code is probably this pull request in NextJS #44861 that brings those imports to the NextJS codebase, the actual source code of server-only seems to match that, despite different author and being released a year before the package. Maybe I am missing something here?

Finally in the react.dev docs itself, server-only is used as a concept, but also as an actual package in https://react.dev/reference/react/experimental_taintUniqueValue#using-server-only-and-taintuniquevalue-to-prevent-leaking-secrets

Ideally, secrets like this are abstracted into a single helper file that can only be imported by trusted data utilities on the server. The helper can even be tagged with server-only to ensure that this file isn’t imported on the client.

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#keeping-server-only-code-out-of-the-client-environment

@petetnt petetnt added the Documentation Related to Next.js' official documentation. label Oct 10, 2024
@samcx
Copy link
Member
samcx commented Oct 14, 2024

@petetnt Thank you for submitting an issue!

We will take a look at this soon to see how we can document this better :frog-eyes:

@samcx samcx removed the Documentation Related to Next.js' official documentation. label Jan 16, 2025
@a-rebets
Copy link
a-rebets commented Apr 2, 2025

bumping this

@binishjoshi
Copy link

Bumping this again

@Zinnavoy
Copy link

Bumping this.

I must say, without documentation and seeing "Last Updated 3 years ago" makes it even harder to tell if it's official, if it does what it should do (whatever it is if you just stumbled upon it).

@ValentinGurkov
Copy link

Bumping this.

I must say, without documentation and seeing "Last Updated 3 years ago" makes it even harder to tell if it's official, if it does what it should do (whatever it is if you just stumbled upon it).

I don't know about official or not, but t A74F he package is more or less 1 line of code, so it does not really need any further updates. I agree that documentation is severely lacking.

@Zinnavoy
Copy link

Bumping this.
I must say, without documentation and seeing "Last Updated 3 years ago" makes it even harder to tell if it's official, if it does what it should do (whatever it is if you just stumbled upon it).

I don't know about official or not, but the package is more or less 1 line of code, so it does not really need any further updates. I agree that documentation is severely lacking.

Yes, I didn't mean it as in it's outdated but from someone new to Next this could easily be interpreted as such without documentation about the package.

@yasinelbuz
Copy link

Bumping this again

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

7 participants
0