protobufjs 3.6.0 → 3.8.2

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.
Files changed (99) hide show
  1. package/bin/proto2js +16 -4
  2. package/bower.json +1 -1
  3. package/dist/ProtoBuf.js +645 -441
  4. package/dist/ProtoBuf.min.js +96 -96
  5. package/dist/ProtoBuf.min.js.gz +0 -0
  6. package/dist/ProtoBuf.min.map +2 -2
  7. package/dist/ProtoBuf.noparse.js +520 -357
  8. package/dist/ProtoBuf.noparse.min.js +68 -66
  9. package/dist/ProtoBuf.noparse.min.js.gz +0 -0
  10. package/dist/ProtoBuf.noparse.min.map +3 -3
  11. package/docs/ProtoBuf.Builder.Message.html +673 -135
  12. package/docs/ProtoBuf.Builder.Service.html +58 -19
  13. package/docs/ProtoBuf.Builder.html +374 -46
  14. package/docs/ProtoBuf.DotProto.Parser.html +58 -19
  15. package/docs/ProtoBuf.DotProto.Tokenizer.html +104 -19
  16. package/docs/ProtoBuf.DotProto.html +16 -10
  17. package/docs/ProtoBuf.Reflect.Enum.Value.html +207 -33
  18. package/docs/ProtoBuf.Reflect.Enum.html +318 -56
  19. package/docs/ProtoBuf.Reflect.Extension.html +53 -13
  20. package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +450 -68
  21. package/docs/ProtoBuf.Reflect.Message.Field.html +454 -51
  22. package/docs/ProtoBuf.Reflect.Message.OneOf.html +1044 -0
  23. package/docs/ProtoBuf.Reflect.Message.html +378 -64
  24. package/docs/ProtoBuf.Reflect.Namespace.html +333 -51
  25. package/docs/ProtoBuf.Reflect.Service.Method.html +228 -35
  26. package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +262 -41
  27. package/docs/ProtoBuf.Reflect.Service.html +318 -56
  28. package/docs/ProtoBuf.Reflect.T.html +210 -25
  29. package/docs/ProtoBuf.Reflect.html +17 -11
  30. package/docs/ProtoBuf.Util.html +59 -13
  31. package/docs/ProtoBuf.html +235 -67
  32. package/docs/ProtoBuf.js.html +648 -443
  33. package/docs/index.html +4 -2
  34. package/docs/styles/jsdoc-default.css +2 -2
  35. package/examples/protoify/.npmignore +2 -0
  36. package/examples/protoify/README.md +28 -0
  37. package/examples/protoify/index.js +147 -0
  38. package/examples/protoify/json.js +123 -0
  39. package/examples/protoify/json.json +123 -0
  40. package/examples/protoify/json.proto +30 -0
  41. package/examples/protoify/package.json +15 -0
  42. package/examples/protoify/test.js +56 -0
  43. package/examples/websocket/README.md +1 -0
  44. package/examples/websocket/package.json +1 -1
  45. package/externs/ProtoBuf.js +922 -922
  46. package/package.json +3 -3
  47. package/scripts/build.js +58 -58
  48. package/src/ProtoBuf/Builder/Message.js +107 -77
  49. package/src/ProtoBuf/Builder/Service.js +8 -5
  50. package/src/ProtoBuf/Builder.js +71 -37
  51. package/src/ProtoBuf/DotProto/Parser.js +108 -72
  52. package/src/ProtoBuf/DotProto/Tokenizer.js +17 -11
  53. package/src/ProtoBuf/Lang.js +1 -1
  54. package/src/ProtoBuf/Reflect/Enum/Value.js +3 -2
  55. package/src/ProtoBuf/Reflect/Enum.js +9 -5
  56. package/src/ProtoBuf/Reflect/Extension.js +4 -3
  57. package/src/ProtoBuf/Reflect/Message/ExtensionField.js +4 -3
  58. package/src/ProtoBuf/Reflect/Message/Field.js +45 -26
  59. package/src/ProtoBuf/Reflect/Message/OneOf.js +19 -0
  60. package/src/ProtoBuf/Reflect/Message.js +36 -19
  61. package/src/ProtoBuf/Reflect/Namespace.js +19 -15
  62. package/src/ProtoBuf/Reflect/Service/Method.js +9 -5
  63. package/src/ProtoBuf/Reflect/Service/RPCMethod.js +3 -2
  64. package/src/ProtoBuf/Reflect/Service.js +9 -5
  65. package/src/ProtoBuf/Reflect/T.js +20 -6
  66. package/src/ProtoBuf/Reflect.js +9 -0
  67. package/src/ProtoBuf/Util.js +132 -132
  68. package/src/ProtoBuf.js +15 -17
  69. package/src/google/protobuf/descriptor.json +33 -13
  70. package/tests/bench.txt +373 -373
  71. package/tests/complex.json +8 -4
  72. package/tests/custom-options.json +169 -169
  73. package/tests/extend.json +71 -71
  74. package/tests/nodeunit-browser/nodeunit.css +70 -70
  75. package/tests/nodeunit-browser/nodeunit.js +2108 -2108
  76. package/tests/oneof.proto +6 -0
  77. package/tests/options.json +32 -32
  78. package/tests/options.proto +2 -0
  79. package/tests/proto2js/Bar.json +46 -46
  80. package/tests/suite.js +83 -12
  81. package/.idea/.name +0 -1
  82. package/.idea/ProtoBuf.iml +0 -9
  83. package/.idea/dictionaries/Daniel.xml +0 -7
  84. package/.idea/encodings.xml +0 -5
  85. package/.idea/misc.xml +0 -5
  86. package/.idea/modules.xml +0 -9
  87. package/.idea/scopes/scope_settings.xml +0 -5
  88. package/.idea/vcs.xml +0 -7
  89. package/.idea/workspace.xml +0 -551
  90. package/NOTICE +0 -2
  91. package/sandbox/issue146/MyOptions.proto +0 -28
  92. package/sandbox/issue146/Sample.proto +0 -21
  93. package/sandbox/issue146/main.js +0 -3
  94. package/sandbox/issue147/enum.proto +0 -8
  95. package/sandbox/issue147/main.js +0 -3
  96. package/sandbox/issue42/innerextend.proto +0 -18
  97. package/sandbox/issue42/main.js +0 -8
  98. package/sandbox/issue42/outerextend.proto +0 -17
  99. package/v8.log +0 -3828
package/bin/proto2js CHANGED
@@ -42,7 +42,8 @@ if (process.argv.length < 3) {
42
42
  console.log(" -amd[=My.Package] Creates an AMD define instead of just a JSON def.");
43
43
  console.log(" If you do not specify a package, the package");
44
44
  console.log(" declaration from the .proto file is used instead.\n");
45
- console.log("If none of -class, -commonjs or -amd is specified, raw JSON will be returned.\n");
45
+ console.log(" -with:name[=key] Sets a builder option, e.g. convertFieldsToCamelCase\n");
46
+ console.log("If none of -class, -commonjs or -amd is specified, raw JSON will be returned.\n");
46
47
  console.log(" -min Minifies the output.\n");
47
48
  console.log(" -path=DIR Adds a directory to the include path.\n");
48
49
  console.log(" -legacy Includes legacy descriptors from google/protobuf/ if");
@@ -63,6 +64,17 @@ for (var i=3; i<process.argv.length; i++) {
63
64
  }
64
65
  }
65
66
  }
67
+ var builderOptions = {};
68
+ Object.keys(options).forEach(function(key) {
69
+ if (key.substring(0,5) === 'with:') {
70
+ var val = options[key];
71
+ if (val === 'true')
72
+ val = true;
73
+ else if (val === 'false')
74
+ val = false;
75
+ builderOptions[key.substring(5)] = val;
76
+ }
77
+ });
66
78
 
67
79
  var sourceFile = process.argv[2],
68
80
  min = !!options['min'],
@@ -224,7 +236,7 @@ function build_shim(pkg, file, min) {
224
236
  path += part[part.length-1];
225
237
  vars += path+WHITESPACE+'='+WHITESPACE;
226
238
  }
227
- return vars+'dcodeIO.ProtoBuf.newBuilder()'+out+'.build('+(pkg !== null ? '"'+pkg+'"' : '')+');';
239
+ return vars+'dcodeIO.ProtoBuf.newBuilder('+JSON.stringify(builderOptions, null, min ? 0 : 4)+')'+out+'.build('+(pkg !== null ? '"'+pkg+'"' : '')+');';
228
240
  }
229
241
 
230
242
  /**
@@ -246,7 +258,7 @@ function build_commonjs(pkg, file, min) {
246
258
  throw(new Error("Not a valid namespace: "+pkg));
247
259
  }
248
260
  var WHITESPACE = min ? '' : ' ';
249
- return 'module.exports'+WHITESPACE+'='+WHITESPACE+'require("protobufjs").newBuilder()'+out+'.build('+(pkg !== null ? '"'+pkg+'"' : '')+');';
261
+ return 'module.exports'+WHITESPACE+'='+WHITESPACE+'require("protobufjs").newBuilder('+JSON.stringify(builderOptions, null, min ? 0 : 4)+')'+out+'.build('+(pkg !== null ? '"'+pkg+'"' : '')+');';
250
262
  }
251
263
 
252
264
  /**
@@ -267,5 +279,5 @@ function build_amd(pkg, file, min) {
267
279
  throw(new Error("Not a valid namespace: "+pkg));
268
280
  }
269
281
  var WHITESPACE = min ? '' : ' ';
270
- return 'define('+(pkg !== null ? '"'+pkg.replace(/\./g, '/').replace(/^\//, "")+'",'+WHITESPACE : '')+'["ProtoBuf"],'+WHITESPACE+'function(ProtoBuf)'+WHITESPACE+'{'+WHITESPACE+'return ProtoBuf.newBuilder()'+out+'.build('+(pkg !== null ? '"'+pkg+'"' : '')+');'+WHITESPACE+'});';
282
+ return 'define('+(pkg !== null ? '"'+pkg.replace(/\./g, '/').replace(/^\//, "")+'",'+WHITESPACE : '')+'["ProtoBuf"],'+WHITESPACE+'function(ProtoBuf)'+WHITESPACE+'{'+WHITESPACE+'return ProtoBuf.newBuilder('+JSON.stringify(builderOptions, null, min ? 0 : 4)+')'+out+'.build('+(pkg !== null ? '"'+pkg+'"' : '')+');'+WHITESPACE+'});';
271
283
  }
package/bower.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "protobuf",
3
3
  "description": "Protocol Buffers for JavaScript. Finally.",
4
- "version": "3.6.0",
4
+ "version": "3.8.2",
5
5
  "main": "dist/ProtoBuf.js",
6
6
  "license": "Apache-2.0",
7
7
  "homepage": "http://dcode.io/",