From 281f2fb97049520da10bdeab402f7ce3d75a5509 Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Sun, 7 Oct 2018 15:52:09 -0700 Subject: [PATCH 1/5] Phase 2 --- doc/plan-for-new-modules-implementation.md | 35 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/doc/plan-for-new-modules-implementation.md b/doc/plan-for-new-modules-implementation.md index fd0ce14..2d34337 100644 --- a/doc/plan-for-new-modules-implementation.md +++ b/doc/plan-for-new-modules-implementation.md @@ -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`. + - 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`. + +* Re-introduce VM module integration. + - Implemented in: https://github.com/nodejs/ecmascript-modules/pull/8. + +## Future Phases + +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). From 383cd86a09ed6e29b1ac15590c0750f0b6004710 Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Fri, 19 Oct 2018 07:58:06 -0700 Subject: [PATCH 2/5] Revisions per call with @MylesBorins, @SMotaal, @jdalton and @GeoffreyBooth --- doc/plan-for-new-modules-implementation.md | 37 ++++++++++------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/doc/plan-for-new-modules-implementation.md b/doc/plan-for-new-modules-implementation.md index 2d34337..8c3a12d 100644 --- a/doc/plan-for-new-modules-implementation.md +++ b/doc/plan-for-new-modules-implementation.md @@ -52,33 +52,30 @@ These changes are implemented in https://github.com/nodejs/ecmascript-modules/pu ## 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`. - - 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. +* Re-introduce virtual module from source integration. + - Potential implementation in: https://github.com/nodejs/ecmascript-modules/pull/8. -* `createRequireFromURL`, to complement the just-added `createRequireFromPath`. +* Improve CommonJS interoperability. + - Refine `createRequireFromPath`. + - See [https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676](https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676). -* Re-introduce VM module integration. - - Implemented in: https://github.com/nodejs/ecmascript-modules/pull/8. +* Support 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? -## Future Phases - -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)). +* An out-of-band mechanism for command-line disambiguation of source entry point parse goal. + - For example, `--eval`/`STDIN`. -* `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)). +## Phase 3 -* 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). +Phase 3 will tentatively focus on extensible loaders and deliver an environment that allows user-land experimentation. -* Browser-compatible dynamic path searching. +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). -* Multi-mode packages ([#94](https://github.com/nodejs/modules/issues/94)). +## Phase 4 -* ESM in executable files ([#152](https://github.com/nodejs/modules/issues/152)). +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. -* Callable resolver ([#157](https://github.com/nodejs/modules/issues/157)). - -* Mock modules (injection) ([#98](https://github.com/nodejs/modules/issues/98)). +## Future Phases -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). +TBD. \ No newline at end of file From 77c6b6e4dc7402197ab19ea5fbe03b8c227a8b20 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 24 Oct 2018 16:03:51 -0400 Subject: [PATCH 3/5] fixup: update with notes from meeting --- doc/plan-for-new-modules-implementation.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/plan-for-new-modules-implementation.md b/doc/plan-for-new-modules-implementation.md index 8c3a12d..56bd74e 100644 --- a/doc/plan-for-new-modules-implementation.md +++ b/doc/plan-for-new-modules-implementation.md @@ -52,20 +52,17 @@ These changes are implemented in https://github.com/nodejs/ecmascript-modules/pu ## Phase 2 -* Re-introduce virtual module from source integration. +* Explore design space for virtual module from source - Potential implementation in: https://github.com/nodejs/ecmascript-modules/pull/8. * Improve CommonJS interoperability. - Refine `createRequireFromPath`. - See [https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676](https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676). -* Support importing a package entry point, e.g. `import _ from 'lodash'`. +* Define semantics for importing a package entry point, e.. `import _ from 'loadash'` - 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? -* An out-of-band mechanism for command-line disambiguation of source entry point parse goal. - - For example, `--eval`/`STDIN`. - ## Phase 3 Phase 3 will tentatively focus on extensible loaders and deliver an environment that allows user-land experimentation. @@ -78,4 +75,4 @@ Phase 4 will include addressing user feedback gathered from the experimentation ## Future Phases -TBD. \ No newline at end of file +TBD. From 63ce88a09b483380fce4b20741036fc398e0de08 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 24 Oct 2018 16:13:04 -0400 Subject: [PATCH 4/5] fixup: whoops --- doc/plan-for-new-modules-implementation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/plan-for-new-modules-implementation.md b/doc/plan-for-new-modules-implementation.md index 56bd74e..74d4daf 100644 --- a/doc/plan-for-new-modules-implementation.md +++ b/doc/plan-for-new-modules-implementation.md @@ -59,7 +59,7 @@ These changes are implemented in https://github.com/nodejs/ecmascript-modules/pu - Refine `createRequireFromPath`. - See [https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676](https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676). -* Define semantics for importing a package entry point, e.. `import _ from 'loadash'` +* Define semantics for importing a package entry point, e.. `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? From 1adb522bbc957ebd6bc9c84af5746800707124ed Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Wed, 24 Oct 2018 13:13:55 -0700 Subject: [PATCH 5/5] Whoops 2 --- doc/plan-for-new-modules-implementation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/plan-for-new-modules-implementation.md b/doc/plan-for-new-modules-implementation.md index 74d4daf..7fa33b8 100644 --- a/doc/plan-for-new-modules-implementation.md +++ b/doc/plan-for-new-modules-implementation.md @@ -59,7 +59,7 @@ These changes are implemented in https://github.com/nodejs/ecmascript-modules/pu - Refine `createRequireFromPath`. - See [https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676](https://gist.github.com/SMotaal/e73c12bd801d78a3108fa30ecd303676). -* Define semantics for importing a package entry point, e.. `import _ from 'lodash'` +* 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?