ts-protoc-gen
ts-protoc-gen copied to clipboard
added import_style parameter to generate import statements for browser that support es6
Changes
- added a
import_style
parameter with the only meaningful valuees6
, it affect onlyservice=grpc-web
generation code. The purpose of this is generate import/export code that doesn't need browserify,webpack or similar bundler to work in browser that supports es6. - in the test/helpers/fakeGrpcTransport.ts I just changed
new Buffer
toBuffer.from
due this depracation warning.
I need this to use protoc-gen-ts to generate service js file usable in sveltejs + vitejs (rollup bundler).
Passing the import_style
param like --ts_out=service=grpc-web,import_style=es6
the require(...)
statements are replaced by import * as ... from ...
statements, and exports. .... = ...
by export {...}
statements.
Verification
I checked it with a tiny sveltjs+vitejs application.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by:
To complete the pull request process, please assign marcuslongmuir
You can assign the PR to them by writing /assign @marcuslongmuir
in a comment when ready.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
/assign @marcuslongmuir