Skip to content

Conversation

rotu
Copy link
Contributor

@rotu rotu commented Aug 22, 2024

No description provided.

- One scope must only ever point to one registry.
- One registry can host multiple scopes.
- Observations from [email protected]:
- `npm install` installs dependencies listed in the current `package.json`.
Copy link
Member

Choose a reason for hiding this comment

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

I am guessing this is a WIP? Sorry if this is too early of a comment, but I think we should avoid documenting too many specific behaviors. The goal would likely be to call out specifically any unexpected behaviors around the name field specifically but not much else. Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good feedback. yes, a little early, and my additions in this PR definitely need organizing and elaboration.

I think the behavior shows that the description of the name field in npm is (understandably) assuming you are only thinking of package.json describing a package being added to or installed from a registry. At runtime, when package.json is in a module in your node_modules folder, the name field is essentially unused.

Copy link
Member

Choose a reason for hiding this comment

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

… except when it's got an exports field and is self-referencing - then it's quite used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ljharb True! I don’t understand how widespread self-import is. (I didn’t even know it was a special case instead of just node_modules resolution until a day ago or so!) Do you know if there are any stats?

I personally have been using relative URL imports inside a package so as not to repeat the package name everywhere and so I can run my code in a browser without transpilation/bundling.

@rotu rotu marked this pull request as draft August 23, 2024 00:01
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