Making this issue to track discussion and gain consensus around what a minimal kernel would look like in that fork.
what would we want to call the fork? node-esm?
how about a branch called esm, i'd like to still get eyes from collaborators who aren't node modules team members on our changes.
So this is a good thing to discuss
Fork vs branch.
With branches on node core we have one less thing to worry about (a new
repo) but are creating lots of noise for other collaborators (feature?)
A new repo allows us a sandbox, but creates a separate place for
conversations to go (aside from the modules repo)
We could mount node as a Subtree in the modules repo and do pull requests.
This is a bit of a spaceship though.
On Tue, Aug 14, 2018, 7:37 PM Gus Caplan notifications@github.com wrote:
how about a branch called esm
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/modules/issues/166#issuecomment-413049407, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAecV2tJAv5E3xIFYj8w24X2QjAPV1mjks5uQ182gaJpZM4V9PxZ
.
The other thing to discuss is what should go in Node core. Do we keep the current implementation there? Replace it with a minimal one that grows over time? Remove it and leave nothing, and various implementations are all relative to an ESM-less core?
+1 for fork. Until we know where this is going, the less noise, the better.
On Wed, Aug 15, 2018 at 8:05 AM Geoffrey Booth notifications@github.com
wrote:
The other thing to discuss is what should go in Node core. Do we keep the
current implementation there? Replace it with a minimal one that grows over
time? Remove it and leave nothing, and various implementations are all
relative to an ESM-less core?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/modules/issues/166#issuecomment-413095318, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAYnRBoi7ACb_StNumCRiGnzeZ6ufAwNks5uQ6wjgaJpZM4V9PxZ
.
What should go in? Leave everything as is, as this is the easiest, and
start discussing what should be taken out. (or put in.)
On Wed, Aug 15, 2018 at 10:15 AM Gil Tayar gil@tayar.org wrote:
+1 for fork. Until we know where this is going, the less noise, the better.
On Wed, Aug 15, 2018 at 8:05 AM Geoffrey Booth notifications@github.com
wrote:The other thing to discuss is what should go in Node core. Do we keep the
current implementation there? Replace it with a minimal one that grows over
time? Remove it and leave nothing, and various implementations are all
relative to an ESM-less core?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/modules/issues/166#issuecomment-413095318,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAYnRBoi7ACb_StNumCRiGnzeZ6ufAwNks5uQ6wjgaJpZM4V9PxZ
.
Let me suggest a minimum implementation. The idea of this minimum is to 1) have all ESM functionality included, and 2) avoid a debate on all the thorny issues.
So it includes:
import an ESM either with import from in an ESM file, or using dynamic import from a CJS or ESMimport will not guess the file extension and will import the file as ESM:import ... from './foo.js' or import ... from './foo.mjs' will both import an ESM from the corresponding files because the extensions have no meaning. It could be ./foo.foo for all it cares! It is important to note that this will probably not be the end result, but is again, a minimal decision that will likely change, and that avoids discussing the file extension problem till we're ready.package.json main property and will load that as ESM. Again, will not guess the file extension.index.js because that will provoke a "file extension debate", and we all want to evade that.node_modules in parent dir...), except that it will not look for index.js (or index.mjs).import an ESM, because that is in the JS spec, and is mostly a consensus in the group (I hope...).require a CJS file.import.meta.require PR to enable this, as this is easily removable later if another interop mechanism is chosen.That's it.
It will not look for index.js because that will provoke a "file extension debate", and we all want to evade that.
node looks for index.{any registered file extension} atm, will we still support that with your proposal?
I think folder lookup can be something else that gets added later. If you _really_ want to be minimal, you could also leave out package resolution, to allow for either the CommonJS require algorithm or the package name maps proposal.
Minimal kernel imho:
i would still say that any situation where we land without node resolution enabled by default is unworkable, and so it should be part of the kernel.
@devsnek I don't agree with you, and thus we don't have consensus. We can't remove it later and thus I think it shouldn't be in the kernel
@MylesBorins - I'm assuming your minimal kernel also doesn't assume an extension, and the extension has to be explicitly in the name?
@giltayar indeed
@MylesBorins thanks for creating the repo. Should we start by pushing node's master branch to it?
I'm trying to push right now. Super slow wifi 😅
On Wed, Aug 22, 2018, 12:32 PM Michaël Zasso notifications@github.com
wrote:
@MylesBorins https://github.com/MylesBorins thanks for creating the
repo. Should we start by pushing node's master branch to it?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/modules/issues/166#issuecomment-415152094, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAecV_3G_dE92zy3teRzp9tX6wfmtv2bks5uTbHSgaJpZM4V9PxZ
.
Fork is up and running
edit: to be explicit this is not something that would ever be shipping. The purpose of this kernel is to build a subset implementation that can be used to implement all features we are currently debating to allow pull requests for specific features or full proposals to build on top of the same code base (and likely share more code)
pkg.module ? Or will pkg.main still lookup the file extension (as an exception)? This feels inconsistent/confusing if paths searching is removed...
⚠️ Note I'm not talking about support
.jsfor ESM or the like, just how this is supposed to work
package.json
{
"main": "./file" // What happens if e.g ./file.js || ./file.mjs is explicitly defined?
}
package.json
{
"main": "./file.js",
"module": "./file.mjs"
}
?
@michael-ciniawsky I think the intent was to support package.main as a means to specify the entry point of a module, and that this path would need to be explicit (no path searching).
We were debating if this should even be supported, perhaps it should be dropped.
here's a doc so people can comment and offer suggestions for changes. If you would like to suggest alternative proposals please do so in the issue
https://docs.google.com/document/d/1uq3v1h3dUXmjMAabQCsxdj7Ig2lOpaty1u4HcUi8whQ/edit?usp=sharing
So no 'dual-mode' packages (for now) ?
indeed. It is something that would be part of a future enhancement to the kernel, dependent on the feature set
I've opened a PR to add documentation about our minimal kernel to the repo. Please comment / approve / reject in there rather than the google doc https://github.com/nodejs/modules/pull/180
We have a PR open to solve this, going to close the issue
Most helpful comment
Minimal kernel imho: