| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
`--es-module-specifier-resolution` is the only flagged portion of the ESM implementation that does not have the word experimental in the flag name. This commit changes the flag to: `--experimental-specifier-resolution` `--es-module-specifier-resolution` remains as an alias for backwards compatibility but it is no longer documented.
|
/cc @nodejs/modules |
Sorry, something went wrong.
|
I believe that not having this flag prefixed by experimental was an oversight. Prior art in renaming another flag before we unflagged modules |
Sorry, something went wrong.
|
It now gives a reasonable warning if you attempt to use both flags at the same time. |
Sorry, something went wrong.
There was a problem hiding this comment.
If we're changing the name I wonder if it might make sense to change the name of the extension searching resolution to --experimental-specifier-resolution=legacy or --experimental-specifier-resolution=compat or something like that?
Sorry, something went wrong.
There was a problem hiding this comment.
Maybe --experimental-specifier-resolution=require to make it obvious what it is emulating?
Sorry, something went wrong.
There was a problem hiding this comment.
I'm pretty sure there was some distaste towards the implication that the flag was for legacy compatibility - the flag exists to test an alternative that could be a viable way forward.
Sorry, something went wrong.
There was a problem hiding this comment.
Would --experimental-specifier-resolution=detect capture the semantics?
Sorry, something went wrong.
There was a problem hiding this comment.
I'm happy to go with what we have though, and have approved the PR.
Sorry, something went wrong.
There was a problem hiding this comment.
require or commonjs or detect all would be acceptable to me; legacy would not. (leaving it as "node" is also fine ofc)
Sorry, something went wrong.
There was a problem hiding this comment.
errr, if you want a new name, why not implicit to mirror explicit?
Sorry, something went wrong.
|
I don't think we should be changing the values. It might not be ideal, but
at least this PR should be non disruptive as it is backwards compatible.
If we are going to change the values I think it would make sense to do
before officially supporting the feature if we go that route
…On Wed, Nov 27, 2019, 5:57 PM Guy Bedford ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In doc/api/cli.md
<#30678 (comment)>:
> @@ -223,6 +209,20 @@ added: v13.1.0
Enable experimental support for a package using `require` or `import` to load
itself.
+### `--experimental-specifier-resolution=mode`
+<!-- YAML
+added: REPLACEME
+-->
+
+Sets the resolution algorithm for resolving ES module specifiers. Valid options
+are `explicit` and `node`.
I'm happy to go with what we have though, and have approved the PR.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#30678?email_source=notifications&email_token=AADZYV5JYOO6HN3EQYGNGILQV33PJA5CNFSM4JSDAMT2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCNHZH6Q#discussion_r351528532>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADZYV7DUJZJKOUAA37IFZ3QV33PJANCNFSM4JSDAMTQ>
.
|
Sorry, something went wrong.
|
We could document / support a new name but keep the old name "node"
supported but undocumented. Thoughts?
I like implicit
…On Wed, Nov 27, 2019, 7:07 PM Wesley Wigham ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In doc/api/cli.md
<#30678 (comment)>:
> @@ -223,6 +209,20 @@ added: v13.1.0
Enable experimental support for a package using `require` or `import` to load
itself.
+### `--experimental-specifier-resolution=mode`
+<!-- YAML
+added: REPLACEME
+-->
+
+Sets the resolution algorithm for resolving ES module specifiers. Valid options
+are `explicit` and `node`.
errr, if you want a new name, why not implicit to mirror explicit?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#30678?email_source=notifications&email_token=AADZYV62DIZJP5ROWMJ74U3QV4DS3A5CNFSM4JSDAMT2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCNH5FNI#discussion_r351542524>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADZYVZT5PUIS7BO7RQG5ITQV4DS3ANCNFSM4JSDAMTQ>
.
|
Sorry, something went wrong.
|
implicit/explicit sounds great to me. |
Sorry, something went wrong.
|
I would just keep node and explicit as they are. implicit to me doesn’t imply that index resolution will happen, and it also (to me) suggests that all extensions will be resolved, rather than just the ones in require.extensions. The node name was well chosen because this is really a Node-specific algorithm, with quirky rules that can’t be summarized in a word or two. If anything I would just call the flag experimental-es-module-specifier-resolution, so that if people read about references to es-module-specifier-resolution (such as from our own blog posts) it’s clear that this new flag is just a renamed version of that. I agree that if this becomes non-experimental, that’s the time to consider renaming things. |
Sorry, something went wrong.
|
I've fixed up broken tests I think this should be good to go @GeoffreyBooth do you really think we need such a verbose flag? Especially since we are adding "experimental" I think it makes sense tot have the flags be slightly different |
Sorry, something went wrong.
| format = getPackageType(url.href) === TYPE_MODULE ? 'module' : 'commonjs'; | ||
| if (!format) { | ||
| if (esModuleSpecifierResolution === 'node') | ||
| if (experimentalSpeciferResolution === 'node') { |
There was a problem hiding this comment.
should we emit the warning on the use of the flag or only when it is active?
Sorry, something went wrong.
There was a problem hiding this comment.
I tend to prefer the pattern in general of having the warning on first use of the feature. That's what we're looking at doing for the other experimental modules features.
Sorry, something went wrong.
There was a problem hiding this comment.
The only problem is this might not catch all usage though - because we have branches in the C++ resolver which check this which may not still catch this path (this path is specifically for non JS file extensions).
So we should either bring the warning to the C++ code, or we should make it a general warning on startup.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Is getting the warning into C++ layer blocking this from landing or should we do it in a follow up?
Sorry, something went wrong.
| &EnvironmentOptions::experimental_specifier_resolution, | ||
| kAllowedInEnvironment); | ||
| AddOption("--es-module-specifier-resolution", | ||
| "", |
There was a problem hiding this comment.
Fun fact, leaving no description on a flag stop it from printing when you run node -h MAGIC!
Sorry, something went wrong.
There was a problem hiding this comment.
We should probably adopt the same for the aliasing of --experimental-loader and --loader actually.
Sorry, something went wrong.
There was a problem hiding this comment.
If this is an alias, shouldn't it be using AddAlias() rather than AddOption()?
Sorry, something went wrong.
There was a problem hiding this comment.
I originally implemented it that way but couldn't figure out how to enforce behavior that both the alias and the actual command couldn't be used at the same time
Ended up manually implemented this here.
There was weird behavior depending on the order of arguments, so I opted to do this instead of hunting down how to get the same behavior as an alias. Is there a better way to do it?
Sorry, something went wrong.
There was a problem hiding this comment.
I originally implemented it that way but couldn't figure out how to enforce behavior that both the alias and the actual command couldn't be used at the same time
Ended up manually implemented this here.
There was weird behavior depending on the order of arguments, so I opted to do this instead of hunting down how to get the same behavior as an alias. Is there a better way to do it?
¯\_(ツ)_/¯ cc @addaleax
Sorry, something went wrong.
There was a problem hiding this comment.
I originally implemented it that way but couldn't figure out how to enforce behavior that both the alias and the actual command couldn't be used at the same time
I guess we could add a special kind of alias for this, but … why?
Sorry, something went wrong.
There was a problem hiding this comment.
Alternatively, I think this could use at least Implies() to clarify the relation between the two options
Sorry, something went wrong.
There was a problem hiding this comment.
If y'all are happy with just shipping this as is, it is a one off and something that will eventually get removed.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
Windows CI rebuild: https://ci.nodejs.org/job/node-test-commit-windows-fanned/31952/ |
Sorry, something went wrong.
`--es-module-specifier-resolution` is the only flagged portion of the ESM implementation that does not have the word experimental in the flag name. This commit changes the flag to: `--experimental-specifier-resolution` `--es-module-specifier-resolution` remains as an alias for backwards compatibility but it is no longer documented. PR-URL: #30678 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
`--es-module-specifier-resolution` is the only flagged portion of the ESM implementation that does not have the word experimental in the flag name. This commit changes the flag to: `--experimental-specifier-resolution` `--es-module-specifier-resolution` remains as an alias for backwards compatibility but it is no longer documented. PR-URL: #30678 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
`--es-module-specifier-resolution` is the only flagged portion of the ESM implementation that does not have the word experimental in the flag name. This commit changes the flag to: `--experimental-specifier-resolution` `--es-module-specifier-resolution` remains as an alias for backwards compatibility but it is no longer documented. PR-URL: #30678 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
`--es-module-specifier-resolution` is the only flagged portion of the ESM implementation that does not have the word experimental in the flag name. This commit changes the flag to: `--experimental-specifier-resolution` `--es-module-specifier-resolution` remains as an alias for backwards compatibility but it is no longer documented. PR-URL: #30678 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
| Back | FazBrowse Home | New Git URL |
--es-module-specifier-resolution is the only flagged portion of the
ESM implementation that does not have the word experimental in the flag
name. This commit changes the flag to:
--experimental-specifier-resolution
--es-module-specifier-resolution remains as an alias for backwards
compatibility but it is no longer documented.
There is a failing test with this PR test/es-module/test-esm-specifiers-both-flags.mjs. There is not yet handling to ensure both flags can't be used at the same time... unsure the best way to do this with the alias.
It does fail with the wrong message though, and doesn't fail when arguments are in the opposite direction. This might be an unrelated bug in the options parser.