Skip to content
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

added import_style parameter to generate import statements for browser that support es6 #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

safanaj
Copy link

@safanaj safanaj commented Jul 19, 2022

Changes

  • added a import_style parameter with the only meaningful value es6, it affect only service=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 to Buffer.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.

@improbable-prow-robot improbable-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 19, 2022
@improbable-prow-robot
Copy link

[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.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@improbable-prow-robot improbable-prow-robot added the size/M Denotes a PR that changes 40-149 lines, ignoring generated files. label Jul 19, 2022
@safanaj
Copy link
Author

safanaj commented Jul 19, 2022

/assign @MarcusLongmuir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/M Denotes a PR that changes 40-149 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants