protocol-buffers
Advanced tools
Comparing version 4.1.2 to 4.2.0
@@ -8,2 +8,3 @@ #!/usr/bin/env node | ||
var watch = false | ||
var encodings = null | ||
@@ -22,2 +23,4 @@ // handrolled parser to not introduce minimist as this is used a bunch of prod places | ||
watch = true | ||
} else if (n === '--encodings' || n === '-e') { | ||
encodings = v === n ? process.argv[++i] : v.split('=').slice(1).join('=') | ||
} | ||
@@ -52,3 +55,3 @@ } | ||
function compile () { | ||
return protobuf.toJS(fs.readFileSync(filename)) | ||
return protobuf.toJS(fs.readFileSync(filename), { encodings }) | ||
} |
@@ -18,4 +18,5 @@ var os = require('os') | ||
function compile (messages) { | ||
function compile (messages, opts) { | ||
var out = '' | ||
var encodings = opts && opts.encodings | ||
@@ -29,4 +30,4 @@ out += '// This file is auto generated by the protocol-buffers compiler' + os.EOL | ||
out += os.EOL | ||
out += '// Remember to `npm install --save protocol-buffers-encodings`' + os.EOL | ||
out += 'var encodings = require(\'protocol-buffers-encodings\')' + os.EOL | ||
if (!encodings) out += '// Remember to `npm install --save protocol-buffers-encodings`' + os.EOL | ||
out += 'var encodings = require(\'' + (encodings || 'protocol-buffers-encodings') + '\')' + os.EOL | ||
out += 'var varint = encodings.varint' + os.EOL | ||
@@ -33,0 +34,0 @@ out += 'var skip = encodings.skip' + os.EOL |
@@ -40,4 +40,4 @@ var schema = require('protocol-buffers-schema') | ||
module.exports.toJS = function (proto) { | ||
return compileToJS(module.exports(proto, { inlineEnc: true })) | ||
module.exports.toJS = function (proto, opts) { | ||
return compileToJS(module.exports(proto, { inlineEnc: true }), opts) | ||
} |
{ | ||
"name": "protocol-buffers", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"description": "Protocol Buffers for Node.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44139
1216