-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
esm: update example-loader
test fixture & API docs
#29819
Conversation
@bmeck, WDYT? |
@nodejs/modules-active-members @nodejs/documentation This could use some reviews. |
@nodejs/collaborators This could use some reviews. |
@Trott, thanks for reaching out to everyone, the topic of type checking |
As promised, I have created the demonstration repo. It would be great if everyone involved could take a brief moment to ensure that the compilers have their options set correctly. This takes place in tasks/typecheck-sources.js. Thanks in advance! The solution proposed in the PR will be kept up to date on the /to @bmeck @guybedford @jkrems @weswigham @devsnek @vsemozhetbyt @BridgeAR |
example-loader
test fixture & ESM API docs
example-loader
test fixture & ESM API docsexample-loader
test fixture & API docs
I'd like to bring to the attention of those designing the resolver hook API what is probably the most significant finding of this whole effort: the order of the parameters is not ideal for Closure. As it currently stands, Closure emits the following warning:
Apparently, Closure wants the optional param to be last. It might be best to change this while we still can if there's no justification for keeping the current order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general
/to @nodejs/modules-active-members Other than the merge conflict, is anything blocking this? |
We should land this with #30986, which also refactors |
@GeoffreyBooth, how would you recommend we do this? Should I make a PR to your fork? |
Cc @bmeck or @guybedford for opinions. Does this PR have any conflicts with that one? If not yeah, I guess you can PR my branch and then this work becomes part of that PR. Anyone object to this plan? |
No word from @bmeck or @guybedford. Is applying types to the code samples still desired? |
I think it's desired, can you rebase? |
@DerekNonGeneric, this needs a rebase. |
Glad to see there's still interest in this. There are a few reasons why a rebase of this PR hasn't happened yet and some of the discussion about it has happened outside of this thread. Allow me to bring folks up to speed.
I believe @GeoffreyBooth had mentioned that he had the new hook samples as individual files during a sync we had. I'm still unclear whether fixtures can play this dual role as samples or if they should live in a separate directory or even repo. I got a new email address and sent out a hangouts invitation—happy to set up another sync or continue the conversation. Please keep me posted. |
* Remove import of URL & process as they are unnecessary * Improve accuracy of hook's thrown error message * Improve accuracy of parameter & return type annotations * Move assignment of default parameter to inside hook function
/to @HarshithaKP
With my previous comment in mind, I've rebased the PR to continue in the spirit of the original PR. This fixture no longer exists as a sample in the docs, so hopes of embedding it as one are probably lost. I was not the one who added the new samples, but I will note that they are neither valid TypeScript Compiler nor Closure Compiler annotations. Fixing all of them in this PR would beyond its scope, though. There are also two larger examples (the https loader and transpiler loader) that need work. Ideally these samples would live in their own files and be subject to typechecking and linting prior to being embedded into the docs via a templating engine otherwise you inevitably end up providing bad samples to users, which isn't uncommon. |
Closing in favor of #32646 as this branch name is no longer relevant. |
URL
&process
as is unnecessary (they exist in global scope)param
&returns
) to be accurate to both TypeScript & Closure{Function}
type annotation over{function}
parentModuleURL
isundefined
parentModuleURL
to inside theresolve
hook functionPrefer(taken care of in another PR)--experimental-loader
to--loader
Fixes: #29610
Checklist