ts-proto 2.2.5 → 2.2.6

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.
@@ -169,7 +169,10 @@ function getExtensionValue(ctx, extension, data) {
169
169
  return Buffer.from(bytes);
170
170
  }));
171
171
  const result = resultBuffer.toString("base64");
172
- return (0, ts_poet_1.code) `'${extension.name}': ${typeName}.decode(Buffer.from('${result}', 'base64'))`;
172
+ const encoded = ctx.options.env === options_1.EnvOption.NODE
173
+ ? (0, ts_poet_1.code) `Buffer.from('${result}', 'base64')`
174
+ : (0, ts_poet_1.code) `${ctx.utils.bytesFromBase64}("${result}")`;
175
+ return (0, ts_poet_1.code) `'${extension.name}': ${typeName}.decode(${encoded})`;
173
176
  }
174
177
  else {
175
178
  const reader = new wire_1.BinaryReader(data[0]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "description": "",
5
5
  "main": "build/src/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",