-
Notifications
You must be signed in to change notification settings - Fork 27
TC-39 Discussion: Accessing module metadata #133
Comments
What was the result of the discussion? Seems like option 1 would be the simplest for Node. |
Seems like option 2 would be more fitting if it could be specced. Particularly Otherwise, I'd assumed we were going with option 1. Technically I had a fancier plan for this with the assumption of option 1 but I was kinda hand-wavy. It would involve appending something similar to the following at the beginning of every file (similar to how we wrap today):
|
To my knowledge that wouldn't really break anything ESM-wise. |
Option 1 seemed like the most viable. Option 2 was not popular. |
Unpopular solely based on "spec amend no-no" sentiment or because there is some reason that might not be good? |
Unpopular based on syntax ergonomics, adding a new keyword, etc. There was a third option discussed and ruled out that would allow hosts to do essentially what we're doing currently with I believe (@domenic please correct me if I'm wrong) we landed on somethink like the following two options: import { foo } from 'js:context' Or const { foo } = import.meta; |
@bradleymeck seems to have mentioned |
Webkit is pretty hard set against a reserved specifier in whatwg/html#1013 which means pretty much have to do option 2 at this rate. |
Proposal seems to be: https://github.com/domenic/proposal-import-meta |
So yeah, the proposal on the table is to use Note, however, that it's going to be far more likely for browsers to use Also note that the proposal appears to require that |
Erm, did you just describe defeating the point of it? IMO we need to support the currently injected properties. (Except |
@Fishrock123 much like aligning with web browsers on ESM semantics which are largely host defined, we need to stay in line enough to create usefulness rather than friction. We can introduce I'd rather people use |
ah, to note: |
This issue has been inactive for a while and this repository is now obsolete. I'm going to close this, but feel free to open another issue in a relevant active repository (TSC perhaps?) and include a link back to this issue if this is a subject that should receive continued attention. |
@domenic led a discussion at TC-39 today on adding the ability to access module relative metadata (e.g. covering the use case for things like
__dirname
in ES6 modules). The slides are here: https://docs.google.com/presentation/d/1p1BGFY05-iCiop8yV0hNyWU41_wlwwfv6HIDkRNNIBQ/edit?usp=sharingThis is something that we'll need folks here paying attention to and providing feedback on.
The text was updated successfully, but these errors were encountered: