Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Doc: Phase 2 for new modules implementation #196

Merged
merged 5 commits into from
Oct 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions doc/plan-for-new-modules-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,36 @@ 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
Copy link
Contributor

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


* Explore design space for virtual module from source
- Potential implementation in: https://github.com/nodejs/ecmascript-modules/pull/8.
Copy link
Member

Choose a reason for hiding this comment

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

Is this the correct link? Its title is 'Revert "esm: Remove --experimental-vm-modules."'.

Copy link
Contributor

Choose a reason for hiding this comment

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

indeed. We had an implementation that is available upstream that was removed in phase 1. A potential implementation is to simply revert removing it


* Improve CommonJS interoperability.
- Refine `createRequireFromPath`.
- See [https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676](https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676).

* Define semantics for importing a package entry point, e.g. `import _ from 'lodash'`
- Currently this is only possible via an explicit deep import, e.g. `import _ from 'lodash/index.mjs'`. The idea would be to somehow enable the former syntax.
- `package.json` `module` field? `main` field?

## Phase 3

Phase 3 will tentatively focus on extensible loaders and deliver an environment that allows user-land experimentation.

We should try to find a loaders solution that supports all items in the [features list in our README](https://github.com/nodejs/modules/#features).

## Phase 4

Phase 4 will include addressing user feedback gathered from the experimentation enabled by Phase 3 and focus on a holistic and complete experience of ESM in Node.js.

## Future Phases

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