ts-proto 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.markdown +2 -0
- package/build/src/main.js +2 -0
- package/package.json +1 -1
package/README.markdown
CHANGED
|
@@ -372,6 +372,8 @@ Generated code will be placed in the Gradle build directory.
|
|
|
372
372
|
|
|
373
373
|
- With `--ts_proto_opt=exportCommonSymbols=false`, utility types like `DeepPartial` and `protobufPackage` won't be `export`d.
|
|
374
374
|
|
|
375
|
+
Each generated file also exports `protobufFileName`, the path of the `.proto` file it was generated from (for example `export const protobufFileName = "company/foo.proto";`), next to `protobufPackage`; neither is exported with `exportCommonSymbols=false`.
|
|
376
|
+
|
|
375
377
|
This should make it possible to use create barrel imports of the generated output, i.e. `import * from ./foo` and `import * from ./bar`.
|
|
376
378
|
|
|
377
379
|
Note that if you have the same message name used in multiple `*.proto` files, you will still get import conflicts.
|
package/build/src/main.js
CHANGED
|
@@ -49,6 +49,8 @@ function generateFile(ctx, fileDesc) {
|
|
|
49
49
|
// Indicate this file's source protobuf package for reflective use with google.protobuf.Any
|
|
50
50
|
if (options.exportCommonSymbols) {
|
|
51
51
|
chunks.push((0, ts_poet_1.code) `export const protobufPackage = '${fileDesc.package}';`);
|
|
52
|
+
// The source .proto path, e.g. for NestJS's `protoPath` or @grpc/proto-loader
|
|
53
|
+
chunks.push((0, ts_poet_1.code) `export const protobufFileName = '${fileDesc.name}';`);
|
|
52
54
|
}
|
|
53
55
|
// Syntax, unlike most fields, is not repeated and thus does not use an index
|
|
54
56
|
const sourceInfo = sourceInfo_1.default.fromDescriptor(fileDesc);
|