-
Notifications
You must be signed in to change notification settings - Fork 43
Doc: Phase 2 for new modules implementation #196
Changes from 1 commit
281f2fb
383cd86
77c6b6e
63ce88a
1adb522
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,13 +43,42 @@ These features will be part of the first phase of development: | |
| - No extension adding. | ||
| - No directory resolution, including no support for `index.js` or `index.mjs`. | ||
| - No support for `main` field for ESM. | ||
|
|
||
| * Remove current VM implementation | ||
|
|
||
| * Remove current Loader implementation | ||
|
|
||
| These changes are implemented in https://github.com/nodejs/ecmascript-modules/pull/6 | ||
|
|
||
| ## Later Phases | ||
| ## Phase 2 | ||
|
|
||
| * A `--mode` field to enable ESM support in the cases of `--eval` and STDIN input, _or_ any file: `node --mode=esm index.js`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m not sure “or any file” is something that has consensus.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (also this should probably clarify that the mode only applies to the entry point)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also think that the name and value of “mode” should match whatever’s chosen for a package.json field, so I’m not sure those can be separated.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ljharb The idea of the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The challenge is that a mode flag would only cover the entry point; but a package.json field would have to cover any file; the former is easier but IMO should be constrained by the latter.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still skeptical of a flag for the entrypoint. This cannot be placed in a shebang. I'm ok with this being in phase 2, but we should add another entry in the Future Phases to resolve the problem Unix shebang usecase. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I this brings us closer to a starting point without favouring any controversial preferences, but obviously this is more like the one equally
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest rewording to clarify we're talking about entrypoints and that the specifics of the flag are not yet defined. Suggested replacement text:
|
||
| - Using this in `package.json` or being scoped to packages is put off for a later phase. | ||
| - This will be supplemented/replaced by more robust configurability such as designed in ([#160](https://github.com/nodejs/modules/pull/160)) in a later phase. | ||
|
|
||
| * `createRequireFromURL`, to complement the just-added `createRequireFromPath`. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MylesBorins were you looking to rewrite this to something like:
|
||
|
|
||
| * Re-introduce VM module integration. | ||
| - Implemented in: https://github.com/nodejs/ecmascript-modules/pull/8. | ||
|
|
||
| ## Future Phases | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now have two PRs in-flight that define future phases. The wording here seems good for Phase 2. For future phases, I much prefer the intent-driven descriptions of Phase 3 & 4 in #193 rather than the feature-list style we have here because it allows people to first agree on and rally around why we the phases exist before we decide what to put in them. The actual wording doesn't matter so much - it's more about ensuring we're all clear on the purpose of the future phases.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re rewording the entrypoint, sure, I agree with that change. Re the other PR, this PR is meant to supersede the other one. We included the Phase 2 items from that one in this one. I don’t mind removing the Future Phases section, but I don’t think having vague language about the topics for each phase helps us much. I think phases can include PRs/features that span different topics, just as Phase 2 does. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I honestly think that "future phases" make it possible to safely consider and discuss things so that when it is time to write "Phase n" we are collectively more comfortable with locking into those priorities. |
||
|
|
||
| The following features will follow soon in upcoming phases: | ||
|
|
||
| * Loaders ([#82](https://github.com/nodejs/modules/issues/82)), ([#96](https://github.com/nodejs/modules/issues/96)). | ||
|
|
||
| * `package.json` metadata support, including an ESM-compatible design for the `main` and possibly `module` fields; and user-configurable map for file extensions to parse goals, a.k.a. `mimes` field ([#160](https://github.com/nodejs/modules/pull/160)). | ||
|
|
||
| * Browser-compatible specifier resolution ([#109](https://github.com/nodejs/modules/issues/109)), a.k.a. bare imports. See [package name maps](https://github.com/domenic/package-name-maps). | ||
|
|
||
| * Browser-compatible dynamic path searching. | ||
|
|
||
| * Multi-mode packages ([#94](https://github.com/nodejs/modules/issues/94)). | ||
|
|
||
| * ESM in executable files ([#152](https://github.com/nodejs/modules/issues/152)). | ||
|
|
||
| * Callable resolver ([#157](https://github.com/nodejs/modules/issues/157)). | ||
|
|
||
| * Mock modules (injection) ([#98](https://github.com/nodejs/modules/issues/98)). | ||
|
|
||
| There **will** be future phases. We will **not** ship the code produced by Phase 1. This first phase lacks support for important use cases and will not be released as the new modules implementation. | ||
| This is an incomplete list. More features will be added in future phases, based on the [features list in our README](https://github.com/nodejs/modules/#features). | ||
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.
Suggested intro line:
The purpose of Phase 2 is to introduce uncontentious UX enhancements before we deal with user-land extensibility ("loaders").