Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Docs, of the implementation as it is right this moment #51

Merged
merged 7 commits into from
Mar 8, 2019

Conversation

GeoffreyBooth
Copy link
Member

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:

@GeoffreyBooth
Copy link
Member Author

GeoffreyBooth commented Mar 7, 2019

I’ve made some updates per today’s call. Still to do:

In separate PRs:

Original doesn't really make sense in retrospect
@GeoffreyBooth GeoffreyBooth marked this pull request as ready for review March 8, 2019 21:12
@GeoffreyBooth
Copy link
Member Author

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 GeoffreyBooth changed the title [WIP] Docs Docs, of the implementation as it is right this moment Mar 8, 2019
@MylesBorins
Copy link
Contributor

@GeoffreyBooth reviewing rn

Copy link
Contributor

@MylesBorins MylesBorins left a 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

doc/api/cli.md Outdated Show resolved Hide resolved
doc/api/cli.md Outdated Show resolved Hide resolved
doc/api/cli.md Outdated Show resolved Hide resolved
doc/api/esm.md Show resolved Hide resolved
doc/api/esm.md Outdated Show resolved Hide resolved

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
until the root of the volume is reached.

doc/api/esm.md Outdated Show resolved Hide resolved
field.

## Package Scope and File Extensions

Copy link
Contributor

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...

Copy link
Member Author

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
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

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

doc/api/esm.md Outdated Show resolved Hide resolved
@GeoffreyBooth GeoffreyBooth merged commit 884041d into modules-lkgr Mar 8, 2019
@GeoffreyBooth
Copy link
Member Author

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:

  • Section very briefly introducing import and export, linking to MDN; @evanplaice will write
  • Section listing differences between ESM in Node vs browsers
  • Update Specifiers section with info about Windows specifiers; @jdalton do you mind tackling?
  • Add ASCII diagram like this to illustrate package scope and resolution stuff; @SMotaal ?

Maybe:

  • Clearer language explaining the search for package.json.
  • Clearer language defining “package scope.”

In separate PRs:

@GeoffreyBooth GeoffreyBooth deleted the docs branch March 8, 2019 23:30
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
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants