-
Notifications
You must be signed in to change notification settings - Fork 522
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
Shared javascript provider #57
Comments
Any news on this? Is something like NodeModuleInfo going to be made public? Or is the recommended way to interop by creating an aspect similar to the module_mapping_aspect? |
We just had a good discussion at BazelCon. We need to look at the interactions between existing JS consumers and producers - rules_kotlin, rules_nodejs, pubref/rules_node, dropbox/rules_node, rules_typescript, rules_closure, some presumed CoffeeScript rules from @kamalmarhubi and the protobuf rules. We'll have a new Provider ( |
Success criteria:
|
I'm worried that "javascript" is too big a target for a single provider. |
We tossed around the idea of having a larger set of very specific providers but for a set of shared JS providers that becomes too fine grained for the general case. A large number of specific providers would make interop between rules more difficult as potentially every provider type would have to be checked for in consuming rules that can handle a wide variety of javascript modules formats & language levels. We settled on a small set (JSModuleInfo, JSEcmaScriptModuleInfo, JSNamedModuleInfo) for the general cases described here https://docs.google.com/document/d/1ggkY5RqUkVL4aQLYm7esRW978LgX3GUCnQirrk5E1C0/edit#. JSEcmaScriptModuleInfo is landing here #1201 and it allows ts_library outputs to be consumed by the new @bazel/rollup rollup_bundle which will replace the legacy rollup_bundle. As a rule author you can add as many JS providers on top of the set of shared ones as you need for your own purposes and maybe some rules in the ecosystem will require very specific ones. JSModuleInfo which hasn't landed yet and may still be change a bit will likely have the
|
Makes one wish providers had some sort of inheritance/polymorphism aspect.... I suppose we'll just end up writing an aspect that produces the JS (for example I'm just uncertain what the behavior will be if a rule wants to return two providers of |
Lots of providers also can mean lots of actions run if a consumer requests all of them. A combinatorial explosion of them will slow down builds. |
A few update on this: A typescript specific provider DeclarationInfo was also added: https://github.com/bazelbuild/rules_nodejs/blob/master/declaration_provider.bzl The last provider that we had planned is JSModuleInfo which is still pending here: #1040 |
We think we can cover all the use cases with the existing providers. The new one in #1040 is useful in theory as a way to get only direct and not transitive .js outputs from some rule, without relying on ESModule output. But we only needed that in one place and there was an easy workaround. |
(Not sure which repo this belongs in, please redirect if there's somewhere better.)
To handle more compile-to-js languages, we will need a shared provider that they can all use. This is alluded to in this repo in a comment.
The text was updated successfully, but these errors were encountered: