-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
moduleName, __modulename or __dirname #38
Comments
yes, absolutely. in theory, neither If we can justify the need for it, we can probably provide extra metadata when using |
Here are some use cases for a string known within a module that can be used to fetch the module:
These cases are from uses in Traceur. More generally, any code that might in future need |
👍 I like 1 and 2. Let's keep this around until we discuss the metadata exposed thru |
Is there any reason we cannot use a prefixing solution rather than IIFE for this? For node this would be something like replacing Module.wrap to generate this instead: `let __filename=${...};let __dirname=${...};${src}` Minor effect that is going to be visible is you can no longer access |
we have discussed how to access metadata from inside the module, that was two meetings ago (sept meeting notes - last day), and we will be providing a mechanism to access them. Not need to use IIFE for this. |
@caridy are those public somewhere? I don't see it referenced in the repo |
https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-09/sept-24.md close to the end, look for I will keep this issue open until we specced this. |
We use node __dirname in Traceur and I'd like to substitute something that would work under EcmaScript modules.
In node, module source code is wrapped in a function:
that, in effect, extends the language with module-specific operations and values. The ES module solution provides alternatives for the first three arguments. The last two are redundant and in other discussions we've used
__moduleName
as a substitute, where the value is set to the normalized name (and we assume the normalized name is a value path on the system we are running).What shall we be doing for this case? Do we need to justify adding this feature?
The text was updated successfully, but these errors were encountered: