-
Notifications
You must be signed in to change notification settings - Fork 18
Docs, of the implementation as it is right this moment #51
Conversation
I’ve made some updates per today’s call. Still to do:
In separate PRs:
|
Original doesn't really make sense in retrospect
I’m working on a different PR that will need its own docs, which means it needs to build off of this one. So I’d rather merge this in as is and continue to improve it in follow up PRs. The to-do items in my last comment still apply. Any notes about what’s in this PR? |
@GeoffreyBooth reviewing rn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotta run to my next meeting so I only had a chance to review half of this. Feel free to land and iterate.
Would like to have guy review the spec changes though
|
||
The nearest parent `package.json` is defined as the first `package.json` found | ||
when searching in the current folder, that folder’s parent, and so on up | ||
until the root of the volume is reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until the root of the volume is reached. |
field. | ||
|
||
## Package Scope and File Extensions | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the copy here a bit confusing... I'm also struggling to come up with something better.
A package scope is defined as all children of a folder with a package.json that do not themselves have an additional package.json
I think the above is equally confusing though sigh...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s not just “all children,” it’s also the folder that the package.json
itself is in.
|
||
### Supported | ||
```js | ||
// my-app.js, in an ES module package scope because there is a package.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be good to have a quick ascii diagram of the filesystem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-Authored-By: GeoffreyBooth <[email protected]>
Merging to unblock other PRs, but that doesn’t mean I’m rejecting the above comments; they’ll just need to be addressed in follow-on PRs. Expanded to-do list:
Maybe:
In separate PRs:
|
extensionless files should be treated within a particular `package.json` file’s | ||
package scope. Every package in a project’s `node_modules` folder contains its | ||
own `package.json` file, so each project’s dependencies have their own package | ||
scopes. A `package.json` lacking a `"type"` field is treated as if it contained |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't quite true - because we check the extension and throw on conflicts when using "type", while when there is no type there are no conflict errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only throw on conflicts for initial entry points. I was referring to import
statements of files within scopes here, though I acknowledge that I didn’t make that explicit 😄.
Do we need to document the cases for which we error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote the flags sections as part of https://github.com/nodejs/ecmascript-modules/blob/525e8c9b5d0acc7b8b7895f7ea65b592fdf3e2bd/doc/api/cli.md#--typetype--m--a
This PR updates the docs for where the implementation is currently. The idea is to reflect it as it is, not as it’s eventually going to be; when the expected future changes land, the docs should be updated accordingly. The old
--experimental-modules
docs are here.Readable versions: