Permalink
Browse files

Other: Updated tests for new package.json layout; Other: Added break/…

…continue label support to codegen
  • Loading branch information...
dcodeIO committed Jan 5, 2017
1 parent e88d13c commit f22a34a071753bca416732ec4d01892263f543fb
Showing with 51 additions and 5 deletions.
  1. +9 −2 package.json
  2. +1 −1 src/util/codegen/index.js
  3. +1 −1 src/util/codegen/package.json
  4. +39 −1 tests/data/package.js
  5. +1 −0 tests/data/package.proto
@@ -44,7 +44,7 @@
"dependencies": {
"@protobufjs/aspromise": "^1.0.5",
"@protobufjs/base64": "^1.0.5",
"@protobufjs/codegen": "^1.0.4",
"@protobufjs/codegen": "^1.0.5",
"@protobufjs/eventemitter": "^1.0.5",
"@protobufjs/extend": "^1.0.2",
"@protobufjs/fetch": "^1.0.4",
@@ -89,5 +89,12 @@
"zuul": "^3.11.1",
"zuul-ngrok": "^4.0.0"
},
"cliDependencies": [ "chalk", "glob", "jsdoc", "minimist", "tmp", "uglify-js" ]
"cliDependencies": [
"chalk",
"glob",
"jsdoc",
"minimist",
"tmp",
"uglify-js"
]
}
@@ -5,7 +5,7 @@ var blockOpenRe = /[{[]$/,
blockCloseRe = /^[}\]]/,
casingRe = /:$/,
branchRe = /^\s*(?:if|}?else if|while|for)\b|\b(?:else)\s*$/,
breakRe = /\b(?:break|continue);?$|^\s*return\b/;
breakRe = /\b(?:break|continue)(?: \w+)?;?$|^\s*return\b/;

/**
* A closure for generating functions programmatically.
@@ -1,7 +1,7 @@
{
"name": "@protobufjs/codegen",
"description": "A closure for generating functions programmatically.",
"version": "1.0.4",
"version": "1.0.5",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
"repository": {
"type": "git",
@@ -124,8 +124,14 @@ $root.Package = (function() {
*/
$prototype.types = "";

/**
* Package cliDependencies.
* @type {Array.<string>}
*/
$prototype.cliDependencies = $protobuf.util.emptyArray;

// Referenced types
var $types = [null, null, null, null, null, "Package.Repository", null, null, null, null, null, null, null, null, null, null]; $lazyTypes.push($types);
var $types = [null, null, null, null, null, "Package.Repository", null, null, null, null, null, null, null, null, null, null, null]; $lazyTypes.push($types);

/**
* Creates a new Package instance using the specified properties.
@@ -207,6 +213,11 @@ $root.Package = (function() {
if (message.types !== undefined && message.types !== "") {
writer.uint32(138).string(message.types);
}
if (message.cliDependencies) {
for (var i = 0; i < message.cliDependencies.length; ++i) {
writer.uint32(146).string(message.cliDependencies[i]);
}
}
return writer;
};})($protobuf.Writer, $protobuf.util, $types);

@@ -347,6 +358,13 @@ $root.Package = (function() {
message.types = reader.string();
break;

case 18:
if (!(message.cliDependencies && message.cliDependencies.length)) {
message.cliDependencies = [];
}
message.cliDependencies.push(reader.string());
break;

default:
reader.skipType(tag & 7);
break;
@@ -488,6 +506,16 @@ $root.Package = (function() {
return "Package.types: string expected";
}
}
if (message.cliDependencies !== undefined) {
if (!Array.isArray(message.cliDependencies)) {
return "Package.cliDependencies: array expected";
}
for (var i = 0; i < message.cliDependencies.length; ++i) {
if (!util.isString(message.cliDependencies[i])) {
return "Package.cliDependencies: string[] expected";
}
}
}
return null;
};})($protobuf.util, $types);

@@ -560,6 +588,16 @@ $root.Package = (function() {
if (dst.types === undefined && options.defaults) {
dst.types = "";
}
if (src.cliDependencies && src.cliDependencies.length) {
dst.cliDependencies = [];
for (var i = 0; i < src.cliDependencies.length; ++i) {
dst.cliDependencies.push(src.cliDependencies[i]);
}
} else {
if (options.defaults || options.arrays) {
dst.cliDependencies = [];
}
}
}
return dst;
};})($types);
@@ -24,4 +24,5 @@ message Package {
map<string, string> devDependencies = 15;
// map<string, bool> browser = 16;
string types = 17;
repeated string cliDependencies = 18;
}

0 comments on commit f22a34a

Please sign in to comment.