You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
it's because ts_library assumes it can get either devmode JS or prodmode JS from the transitive closure of the deps. The former uses named UMD modules for faster concatenation in the devserver, and is down-leveled for browsers. The latter is intended for bundling optimizers and uses ES modules and ESnext syntax.
There ought to be some way to make a TS -> JS dependency edge, but we need to think about that some more.
No, ts_proto_library doesn't do anything with grpc yet. I'm not sure who would create the .d.ts for proto services, it seems like grpc doesn't want to: grpc/grpc#6630 (comment)
I can't use ts_proto_library: we are using a different plugin to generate TypeScript typings and protobuf.ts is not a viable option (due to protobufjs/protobuf.js#1113). Is there a way to bundle arbitrary JavaScript source files and TypeScript typings so that they are accepted by ts_library? I tried using both npm_package and js_library but neither worked, both yielding the same error:
//workspace/path/to:some-target is neither a TypeScript nor a JS producing rule.
Dependencies must be ts_library
As a follow-up attempt, I tried to "trick" ts_library into thinking the output was indeed coming from a rule that has a js attribute. I'm fairly sure it's a safe assumption in my case, as I just want to use the rule to compile TypeScript and I'm not interested into serving this directly (it's a very simple library that targets Node.js that I want to compile and package).
I wrote my own rule (which I assume would not work at runtime, but it looks like it's failing during the analysis phase):
I tried (in succession) to add a js attribute to the rule, the js field to the implementation provider and as a rule output. None of the approaches worked and the ts_library reported again that the dependency was neither a TypeScript nor a JS producing rule.
Activity
alexeagle commentedon May 11, 2018
it's because
ts_libraryassumes it can get either devmode JS or prodmode JS from the transitive closure of the deps. The former uses named UMD modules for faster concatenation in the devserver, and is down-leveled for browsers. The latter is intended for bundling optimizers and uses ES modules and ESnext syntax.There ought to be some way to make a TS -> JS dependency edge, but we need to think about that some more.
For this particular use case, maybe what you want is a dependency on a ts_proto_library? http://tsetse.info/api/protobufjs/ts_proto_library.html#ts_proto_library
OR, the grpc codegen could generate TypeScript instead. @mrmeku is working on a grpc layer for TS, maybe he can give some guidance.
prestonvanloon commentedon May 12, 2018
Yes,
ts_proto_librarywould solve my problem! Trying it out now. Does it output grpc layer too?alexeagle commentedon May 12, 2018
No,
ts_proto_librarydoesn't do anything with grpc yet. I'm not sure who would create the.d.tsfor protoservices, it seems like grpc doesn't want to: grpc/grpc#6630 (comment)kalbasit commentedon May 25, 2018
@prestonvanloon have you figured out a way to do this?
prestonvanloon commentedon May 26, 2018
@kalbasit I was able to use
ts_proto_libraryto achieve what I wanted. It doesn't include gRPC, but I used the npm modulegrpc.So I wasn't able to use the genrule, but I did find another way to achieve what I wanted to do: A typescript gRPC node.js server.
alexeagle commentedon Jun 1, 2018
Thanks @prestonvanloon
stefanobaghino-da commentedon Feb 28, 2019
I can't use
ts_proto_library: we are using a different plugin to generate TypeScript typings and protobuf.ts is not a viable option (due to protobufjs/protobuf.js#1113). Is there a way to bundle arbitrary JavaScript source files and TypeScript typings so that they are accepted byts_library? I tried using bothnpm_packageandjs_librarybut neither worked, both yielding the same error:stefanobaghino-da commentedon Feb 28, 2019
As a follow-up attempt, I tried to "trick"
ts_libraryinto thinking the output was indeed coming from a rule that has ajsattribute. I'm fairly sure it's a safe assumption in my case, as I just want to use the rule to compile TypeScript and I'm not interested into serving this directly (it's a very simple library that targets Node.js that I want to compile and package).I wrote my own rule (which I assume would not work at runtime, but it looks like it's failing during the analysis phase):
I tried (in succession) to add a
jsattribute to the rule, thejsfield to the implementation provider and as a rule output. None of the approaches worked and thets_libraryreported again that the dependency was neither a TypeScript nor a JS producing rule.