-
Notifications
You must be signed in to change notification settings - Fork 343
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
Feature: Importmap option #596
Labels
Comments
This was referenced Jun 14, 2022
I also need this option, particularly because I import files from vendor/ and want to map the vendor/ path to the repo root. |
iamricard
added a commit
to iamricard/ts-proto
that referenced
this issue
Sep 20, 2022
This commit adds a new feature that aims to provide the same functionality as `M` for the go compiler (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package). I opted for not modifying the type map, because we'll also want to figure out whether or not we need to generate the file, so we'll be acessing the `options.M` everywhere and I found it less confusing to always get mapping information from `options.M` instead of `options.M` or the type map depending on the decision that we're making (we need to know if we need to do a relative import or just the raw provided import too). Fixes stephenh#596
iamricard
added a commit
to iamricard/ts-proto
that referenced
this issue
Sep 20, 2022
This commit adds a new feature that aims to provide the same functionality as `M` for the go compiler (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package). I opted for not modifying the type map, because we'll also want to figure out whether or not we need to generate the file, so we'll be acessing the `options.M` everywhere and I found it less confusing to always get mapping information from `options.M` instead of `options.M` or the type map depending on the decision that we're making (we need to know if we need to do a relative import or just the raw provided import too). Fixes stephenh#596
iamricard
added a commit
to iamricard/ts-proto
that referenced
this issue
Sep 20, 2022
This commit adds a new feature that aims to provide the same functionality as `M` for the go compiler (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package). I opted for not modifying the type map, because we'll also want to figure out whether or not we need to generate the file, so we'll be acessing the `options.M` everywhere and I found it less confusing to always get mapping information from `options.M` instead of `options.M` or the type map depending on the decision that we're making (we need to know if we need to do a relative import or just the raw provided import too). Fixes stephenh#596
iamricard
added a commit
to iamricard/ts-proto
that referenced
this issue
Sep 20, 2022
This commit adds a new feature that aims to provide the same functionality as `M` for the go compiler (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package). I opted for not modifying the type map, because we'll also want to figure out whether or not we need to generate the file, so we'll be accessing the `options.M` everywhere and I found it less confusing to always get mapping information from `options.M` instead of `options.M` or the type map depending on the decision that we're making (we need to know if we need to do a relative import or just the raw provided import too). Fixes stephenh#596
stephenh
pushed a commit
that referenced
this issue
Sep 21, 2022
This commit adds a new feature that aims to provide the same functionality as `M` for the go compiler (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package). I opted for not modifying the type map, because we'll also want to figure out whether or not we need to generate the file, so we'll be accessing the `options.M` everywhere and I found it less confusing to always get mapping information from `options.M` instead of `options.M` or the type map depending on the decision that we're making (we need to know if we need to do a relative import or just the raw provided import too). Fixes #596
🎉 This issue has been resolved in version 1.126.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, a proto import such as
import google/protobuf/empty.proto
generates an import statement like:This assumes the file layout has
../../../../../google/protobuf/empty.ts
in the correct place. However, it is desirable to map this to a different location such as../../../../../external/com_google_protobuf/google/protobuf/empty.ts
, or even some node_module like@google/wellknowntypes
...protoc-gen-go has a similar need for mapping imports and supports the
M
option, used like--go_opt=Mtest.proto=github.com/example.com/test
.emitImportedFiles=true
is a possible workaround, but has other drawbacks and cannot be used in our case.I propose a similar option, for example
--ts_opt=M./google/protobuf/empty=./external/com_google_protobuf/google/protobuf/empty
that would generate:This would involve PRs to both ts-proto and ts-poet.
Would you be amenable to such PRs?
The text was updated successfully, but these errors were encountered: