-
Notifications
You must be signed in to change notification settings - Fork 59
Description
It looks like some not-yet-production-ready files from your feat-remove-template-lib branch somehow made it into the published npm package (noticed in 5.1.2).
This breaks ts generation with the error protoc-gen-ts error: TypeError: Cannot read property 'recognized' of undefined because build/lib/template/partial/msg/MessageRender.js contains .replace("#FIELDS#", this.renderFields); which probably should be something like .replace("#FIELDS#", this.renderFields());
I tried with your examples to see if I maybe got something backwards, but saw the same error.
Diffing the master source https://github.com/agreatfool/grpc_tools_node_protoc_ts/tree/v5.1.2 vs. the node module (for example):
git diff --no-index ../build/index.js ./node_modules/grpc_tools_node_protoc_ts/build/index.js
--- a/../build/index.js
+++ b/./node_modules/grpc_tools_node_protoc_ts/build/index.js
@@ -12,6 +12,7 @@ const plugin_pb_1 = require("google-protobuf/google/protobuf/compiler/plugin_pb"
const ProtoMsgTsdFormatter_1 = require("./lib/format/ProtoMsgTsdFormatter");
const ProtoSvcTsdFormatter_1 = require("./lib/format/ProtoSvcTsdFormatter");
const TplEngine_1 = require("./lib/TplEngine");
+const MsgRender_1 = require("./lib/template/MsgRender");
Utility_1.Utility.withAllStdIn((inputBuff) => {
try {
const typedInputBuff = new Uint8Array(inputBuff.length);
@@ -31,6 +32,11 @@ Utility_1.Utility.withAllStdIn((inputBuff) => {
const msgTsdFile = new plugin_pb_1.CodeGeneratorResponse.File();
msgTsdFile.setName(msgFileName + ".d.ts");
const msgModel = ProtoMsgTsdFormatter_1.ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
+ // FIXME
+ const fs = require("fs");
+ const { inspect } = require("util");
+ fs.writeFileSync("/tmp/console.txt", inspect(msgModel, { showHidden: true, depth: null }));
+ fs.writeFileSync("/tmp/msg.d.ts", new MsgRender_1.MsgRender(msgModel).render());
msgTsdFile.setContent(TplEngine_1.TplEngine.render("msg_tsd", msgModel));
codeGenResponse.addFile(msgTsdFile);
// service part