protobufjs 4.1.2 → 5.0.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.
- package/.travis.yml +3 -1
- package/README.md +147 -25
- package/bin/pbjs +2 -2
- package/bower.json +3 -3
- package/cli/pbjs/targets/amd.js +1 -1
- package/cli/pbjs/targets/json.js +9 -1
- package/cli/pbjs/targets/proto.js +48 -24
- package/cli/pbjs/util.js +1 -1
- package/cli/pbjs.js +9 -2
- package/dist/README.md +10 -10
- package/dist/{ProtoBuf-light.js → protobuf-light.js} +207 -152
- package/dist/protobuf-light.min.js +94 -0
- package/dist/protobuf-light.min.js.gz +0 -0
- package/dist/protobuf-light.min.map +8 -0
- package/dist/{ProtoBuf.js → protobuf.js} +265 -175
- package/dist/protobuf.min.js +116 -0
- package/dist/protobuf.min.js.gz +0 -0
- package/dist/protobuf.min.map +8 -0
- package/docs/ProtoBuf.Builder.Message.html +1473 -967
- package/docs/ProtoBuf.Builder.Service.html +266 -197
- package/docs/ProtoBuf.Builder.html +758 -542
- package/docs/ProtoBuf.DotProto.Parser.html +223 -161
- package/docs/ProtoBuf.DotProto.Tokenizer.html +344 -248
- package/docs/ProtoBuf.DotProto.html +20 -12
- package/docs/ProtoBuf.Element.html +554 -554
- package/docs/ProtoBuf.Map.html +158 -123
- package/docs/ProtoBuf.Reflect.Element.html +286 -143
- package/docs/ProtoBuf.Reflect.Enum.Value.html +329 -228
- package/docs/ProtoBuf.Reflect.Enum.html +757 -537
- package/docs/ProtoBuf.Reflect.Extension.html +73 -56
- package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +1013 -740
- package/docs/ProtoBuf.Reflect.Message.Field.html +926 -649
- package/docs/ProtoBuf.Reflect.Message.OneOf.html +327 -245
- package/docs/ProtoBuf.Reflect.Message.html +919 -652
- package/docs/ProtoBuf.Reflect.Namespace.html +648 -447
- package/docs/ProtoBuf.Reflect.Service.Method.html +363 -251
- package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +545 -397
- package/docs/ProtoBuf.Reflect.Service.html +721 -511
- package/docs/ProtoBuf.Reflect.T.html +268 -197
- package/docs/ProtoBuf.Reflect.html +20 -12
- package/docs/ProtoBuf.Util.html +169 -118
- package/docs/ProtoBuf.html +840 -628
- package/docs/ProtoBuf.js.html +271 -180
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/index.html +7 -5
- package/docs/styles/jsdoc-default.css +95 -75
- package/docs/styles/prettify-tomorrow.css +1 -1
- package/donate.png +0 -0
- package/examples/protoify/json.js +123 -123
- package/examples/protoify/json.json +123 -123
- package/examples/websocket/server.js +4 -4
- package/externs/{ProtoBuf.js → protobuf.js} +933 -922
- package/index.js +1 -18
- package/jsdoc.json +1 -1
- package/package.json +11 -11
- package/protobuf.png +0 -0
- package/scripts/build.js +53 -58
- package/src/ProtoBuf/Builder/Message.js +18 -9
- package/src/ProtoBuf/Builder/Service.js +3 -0
- package/src/ProtoBuf/Builder.js +34 -10
- package/src/ProtoBuf/DotProto/Parser.js +58 -23
- package/src/ProtoBuf/Reflect/Element.js +17 -4
- package/src/ProtoBuf/Reflect/Message/Field.js +6 -5
- package/src/ProtoBuf/Reflect/Message.js +9 -4
- package/src/ProtoBuf/Util.js +116 -116
- package/src/bower.json +2 -2
- package/src/google/protobuf/descriptor.json +55 -15
- package/src/{ProtoBuf.js → protobuf.js} +0 -0
- package/src/wrap.js +4 -4
- package/tests/bench.txt +373 -373
- package/tests/complex.json +8 -1
- package/tests/custom-options.json +169 -169
- package/tests/extend.json +71 -71
- package/tests/imports-weak.proto +7 -0
- package/tests/imports.json +83 -83
- package/tests/nodeunit-browser/nodeunit.css +70 -70
- package/tests/nodeunit-browser/nodeunit.js +2108 -2108
- package/tests/options.json +32 -32
- package/tests/proto2js/Bar.json +46 -46
- package/tests/suite.js +107 -82
- package/ProtoBuf.png +0 -0
- package/dist/ProtoBuf-light.min.js +0 -87
- package/dist/ProtoBuf-light.min.js.gz +0 -0
- package/dist/ProtoBuf-light.min.map +0 -8
- package/dist/ProtoBuf.min.js +0 -108
- package/dist/ProtoBuf.min.js.gz +0 -0
- package/dist/ProtoBuf.min.map +0 -8
- package/externs/ByteBuffer.js +0 -767
- package/externs/Long.js +0 -328
- package/sandbox/gapi/googleapis/google/api/annotations.proto +0 -29
- package/sandbox/gapi/googleapis/google/api/http.proto +0 -245
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/datastore.proto +0 -281
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/entity.proto +0 -189
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/query.proto +0 -281
- package/sandbox/gapi/googleapis/google/longrunning/operations.proto +0 -144
- package/sandbox/gapi/googleapis/google/protobuf/any.proto +0 -98
- package/sandbox/gapi/googleapis/google/protobuf/any_test.proto +0 -41
- package/sandbox/gapi/googleapis/google/protobuf/api.proto +0 -201
- package/sandbox/gapi/googleapis/google/protobuf/descriptor.proto +0 -773
- package/sandbox/gapi/googleapis/google/protobuf/duration.proto +0 -95
- package/sandbox/gapi/googleapis/google/protobuf/empty.proto +0 -50
- package/sandbox/gapi/googleapis/google/protobuf/field_mask.proto +0 -167
- package/sandbox/gapi/googleapis/google/protobuf/map_lite_unittest.proto +0 -130
- package/sandbox/gapi/googleapis/google/protobuf/map_proto2_unittest.proto +0 -60
- package/sandbox/gapi/googleapis/google/protobuf/map_unittest.proto +0 -129
- package/sandbox/gapi/googleapis/google/protobuf/map_unittest_proto3.proto +0 -120
- package/sandbox/gapi/googleapis/google/protobuf/source_context.proto +0 -47
- package/sandbox/gapi/googleapis/google/protobuf/struct.proto +0 -94
- package/sandbox/gapi/googleapis/google/protobuf/timestamp.proto +0 -107
- package/sandbox/gapi/googleapis/google/protobuf/type.proto +0 -176
- package/sandbox/gapi/googleapis/google/protobuf/unittest.proto +0 -878
- package/sandbox/gapi/googleapis/google/protobuf/unittest_arena.proto +0 -46
- package/sandbox/gapi/googleapis/google/protobuf/unittest_custom_options.proto +0 -394
- package/sandbox/gapi/googleapis/google/protobuf/unittest_drop_unknown_fields.proto +0 -58
- package/sandbox/gapi/googleapis/google/protobuf/unittest_embed_optimize_for.proto +0 -51
- package/sandbox/gapi/googleapis/google/protobuf/unittest_empty.proto +0 -38
- package/sandbox/gapi/googleapis/google/protobuf/unittest_enormous_descriptor.proto +0 -1048
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import.proto +0 -66
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_lite.proto +0 -52
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_proto3.proto +0 -68
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public.proto +0 -41
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_lite.proto +0 -43
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_proto3.proto +0 -42
- package/sandbox/gapi/googleapis/google/protobuf/unittest_lite.proto +0 -385
- package/sandbox/gapi/googleapis/google/protobuf/unittest_lite_imports_nonlite.proto +0 -44
- package/sandbox/gapi/googleapis/google/protobuf/unittest_mset.proto +0 -82
- package/sandbox/gapi/googleapis/google/protobuf/unittest_mset_wire_format.proto +0 -52
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena.proto +0 -202
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_import.proto +0 -37
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_lite.proto +0 -42
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_field_presence.proto +0 -138
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_generic_services.proto +0 -54
- package/sandbox/gapi/googleapis/google/protobuf/unittest_optimize_for.proto +0 -67
- package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum.proto +0 -71
- package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum2.proto +0 -50
- package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3.proto +0 -388
- package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3_arena.proto +0 -206
- package/sandbox/gapi/googleapis/google/protobuf/unittest_well_known_types.proto +0 -112
- package/sandbox/gapi/googleapis/google/protobuf/unknown_enum_test.proto +0 -62
- package/sandbox/gapi/googleapis/google/protobuf/wrappers.proto +0 -117
- package/sandbox/gapi/googleapis/google/rpc/code.proto +0 -190
- package/sandbox/gapi/googleapis/google/rpc/error_details.proto +0 -157
- package/sandbox/gapi/googleapis/google/rpc/status.proto +0 -90
- package/sandbox/gapi/googleapis/google/type/color.proto +0 -163
- package/sandbox/gapi/googleapis/google/type/date.proto +0 -43
- package/sandbox/gapi/googleapis/google/type/dayofweek.proto +0 -50
- package/sandbox/gapi/googleapis/google/type/latlng.proto +0 -36
- package/sandbox/gapi/googleapis/google/type/money.proto +0 -40
- package/sandbox/gapi/googleapis/google/type/timeofday.proto +0 -42
- package/sandbox/gapi/test.js +0 -17
- package/sandbox/gapi/test.proto +0 -12
- package/sandbox/issue146/MyOptions.proto +0 -28
- package/sandbox/issue146/Sample.proto +0 -21
- package/sandbox/issue146/main.js +0 -3
- package/sandbox/issue147/enum.proto +0 -8
- package/sandbox/issue147/main.js +0 -3
- package/sandbox/issue182/commands.proto +0 -10
- package/sandbox/issue182/execute.js +0 -22
- package/sandbox/issue182/session_commands.proto +0 -14
- package/sandbox/issue289/A.proto +0 -8
- package/sandbox/issue289/B.proto +0 -8
- package/sandbox/issue289/common.proto +0 -5
- package/sandbox/issue289/main.js +0 -7
- package/sandbox/issue300/IAuth.proto +0 -14
- package/sandbox/issue300/Request.proto +0 -14
- package/sandbox/issue300/main.js +0 -26
- package/sandbox/issue42/innerextend.proto +0 -18
- package/sandbox/issue42/main.js +0 -8
- package/sandbox/issue42/outerextend.proto +0 -17
- package/tests/gtfs-realtime.proto +0 -552
- package/webpack.config.js +0 -9
package/src/ProtoBuf/Util.js
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @alias ProtoBuf.Util
|
|
3
|
-
* @expose
|
|
4
|
-
*/
|
|
5
|
-
ProtoBuf.Util = (function() {
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* ProtoBuf utilities.
|
|
10
|
-
* @exports ProtoBuf.Util
|
|
11
|
-
* @namespace
|
|
12
|
-
*/
|
|
13
|
-
var Util = {};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Flag if running in node or not.
|
|
17
|
-
* @type {boolean}
|
|
18
|
-
* @const
|
|
19
|
-
* @expose
|
|
20
|
-
*/
|
|
21
|
-
Util.IS_NODE = !!(
|
|
22
|
-
typeof process === 'object' && process+'' === '[object process]' && !process['browser']
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Constructs a XMLHttpRequest object.
|
|
27
|
-
* @return {XMLHttpRequest}
|
|
28
|
-
* @throws {Error} If XMLHttpRequest is not supported
|
|
29
|
-
* @expose
|
|
30
|
-
*/
|
|
31
|
-
Util.XHR = function() {
|
|
32
|
-
// No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
|
|
33
|
-
var XMLHttpFactories = [
|
|
34
|
-
function () {return new XMLHttpRequest()},
|
|
35
|
-
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
|
|
36
|
-
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
|
|
37
|
-
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
|
|
38
|
-
];
|
|
39
|
-
/** @type {?XMLHttpRequest} */
|
|
40
|
-
var xhr = null;
|
|
41
|
-
for (var i=0;i<XMLHttpFactories.length;i++) {
|
|
42
|
-
try { xhr = XMLHttpFactories[i](); }
|
|
43
|
-
catch (e) { continue; }
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
if (!xhr)
|
|
47
|
-
throw Error("XMLHttpRequest is not supported");
|
|
48
|
-
return xhr;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Fetches a resource.
|
|
53
|
-
* @param {string} path Resource path
|
|
54
|
-
* @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
|
|
55
|
-
* be fetched synchronously. If the request failed, contents will be null.
|
|
56
|
-
* @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
|
|
57
|
-
* @expose
|
|
58
|
-
*/
|
|
59
|
-
Util.fetch = function(path, callback) {
|
|
60
|
-
if (callback && typeof callback != 'function')
|
|
61
|
-
callback = null;
|
|
62
|
-
if (Util.IS_NODE) {
|
|
63
|
-
var fs = require("fs");
|
|
64
|
-
if (callback) {
|
|
65
|
-
fs.readFile(path, function(err, data) {
|
|
66
|
-
if (err)
|
|
67
|
-
callback(null);
|
|
68
|
-
else
|
|
69
|
-
callback(""+data);
|
|
70
|
-
});
|
|
71
|
-
} else
|
|
72
|
-
try {
|
|
73
|
-
return fs.readFileSync(path);
|
|
74
|
-
} catch (e) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
var xhr = Util.XHR();
|
|
79
|
-
xhr.open('GET', path, callback ? true : false);
|
|
80
|
-
// xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
|
|
81
|
-
xhr.setRequestHeader('Accept', 'text/plain');
|
|
82
|
-
if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
|
|
83
|
-
if (callback) {
|
|
84
|
-
xhr.onreadystatechange = function() {
|
|
85
|
-
if (xhr.readyState != 4) return;
|
|
86
|
-
if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
|
|
87
|
-
callback(xhr.responseText);
|
|
88
|
-
else
|
|
89
|
-
callback(null);
|
|
90
|
-
};
|
|
91
|
-
if (xhr.readyState == 4)
|
|
92
|
-
return;
|
|
93
|
-
xhr.send(null);
|
|
94
|
-
} else {
|
|
95
|
-
xhr.send(null);
|
|
96
|
-
if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
|
|
97
|
-
return xhr.responseText;
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Converts a string to camel case.
|
|
105
|
-
* @param {string} str
|
|
106
|
-
* @returns {string}
|
|
107
|
-
* @expose
|
|
108
|
-
*/
|
|
109
|
-
Util.toCamelCase = function(str) {
|
|
110
|
-
return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
|
|
111
|
-
return $1.toUpperCase();
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
return Util;
|
|
116
|
-
})();
|
|
1
|
+
/**
|
|
2
|
+
* @alias ProtoBuf.Util
|
|
3
|
+
* @expose
|
|
4
|
+
*/
|
|
5
|
+
ProtoBuf.Util = (function() {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ProtoBuf utilities.
|
|
10
|
+
* @exports ProtoBuf.Util
|
|
11
|
+
* @namespace
|
|
12
|
+
*/
|
|
13
|
+
var Util = {};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Flag if running in node or not.
|
|
17
|
+
* @type {boolean}
|
|
18
|
+
* @const
|
|
19
|
+
* @expose
|
|
20
|
+
*/
|
|
21
|
+
Util.IS_NODE = !!(
|
|
22
|
+
typeof process === 'object' && process+'' === '[object process]' && !process['browser']
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a XMLHttpRequest object.
|
|
27
|
+
* @return {XMLHttpRequest}
|
|
28
|
+
* @throws {Error} If XMLHttpRequest is not supported
|
|
29
|
+
* @expose
|
|
30
|
+
*/
|
|
31
|
+
Util.XHR = function() {
|
|
32
|
+
// No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
|
|
33
|
+
var XMLHttpFactories = [
|
|
34
|
+
function () {return new XMLHttpRequest()},
|
|
35
|
+
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
|
|
36
|
+
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
|
|
37
|
+
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
|
|
38
|
+
];
|
|
39
|
+
/** @type {?XMLHttpRequest} */
|
|
40
|
+
var xhr = null;
|
|
41
|
+
for (var i=0;i<XMLHttpFactories.length;i++) {
|
|
42
|
+
try { xhr = XMLHttpFactories[i](); }
|
|
43
|
+
catch (e) { continue; }
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
if (!xhr)
|
|
47
|
+
throw Error("XMLHttpRequest is not supported");
|
|
48
|
+
return xhr;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Fetches a resource.
|
|
53
|
+
* @param {string} path Resource path
|
|
54
|
+
* @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
|
|
55
|
+
* be fetched synchronously. If the request failed, contents will be null.
|
|
56
|
+
* @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
|
|
57
|
+
* @expose
|
|
58
|
+
*/
|
|
59
|
+
Util.fetch = function(path, callback) {
|
|
60
|
+
if (callback && typeof callback != 'function')
|
|
61
|
+
callback = null;
|
|
62
|
+
if (Util.IS_NODE) {
|
|
63
|
+
var fs = require("fs");
|
|
64
|
+
if (callback) {
|
|
65
|
+
fs.readFile(path, function(err, data) {
|
|
66
|
+
if (err)
|
|
67
|
+
callback(null);
|
|
68
|
+
else
|
|
69
|
+
callback(""+data);
|
|
70
|
+
});
|
|
71
|
+
} else
|
|
72
|
+
try {
|
|
73
|
+
return fs.readFileSync(path);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
var xhr = Util.XHR();
|
|
79
|
+
xhr.open('GET', path, callback ? true : false);
|
|
80
|
+
// xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
|
|
81
|
+
xhr.setRequestHeader('Accept', 'text/plain');
|
|
82
|
+
if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
|
|
83
|
+
if (callback) {
|
|
84
|
+
xhr.onreadystatechange = function() {
|
|
85
|
+
if (xhr.readyState != 4) return;
|
|
86
|
+
if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
|
|
87
|
+
callback(xhr.responseText);
|
|
88
|
+
else
|
|
89
|
+
callback(null);
|
|
90
|
+
};
|
|
91
|
+
if (xhr.readyState == 4)
|
|
92
|
+
return;
|
|
93
|
+
xhr.send(null);
|
|
94
|
+
} else {
|
|
95
|
+
xhr.send(null);
|
|
96
|
+
if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
|
|
97
|
+
return xhr.responseText;
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Converts a string to camel case.
|
|
105
|
+
* @param {string} str
|
|
106
|
+
* @returns {string}
|
|
107
|
+
* @expose
|
|
108
|
+
*/
|
|
109
|
+
Util.toCamelCase = function(str) {
|
|
110
|
+
return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
|
|
111
|
+
return $1.toUpperCase();
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return Util;
|
|
116
|
+
})();
|
package/src/bower.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"name": "protobuf",
|
|
3
3
|
"description": "Protocol Buffers for JavaScript. Finally.",
|
|
4
4
|
"version": /*?== VERSION */,
|
|
5
|
-
"main": "dist/
|
|
5
|
+
"main": "dist/protobuf.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"homepage": "http://dcode.io/",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"bytebuffer": "~
|
|
9
|
+
"bytebuffer": "~5"
|
|
10
10
|
},
|
|
11
11
|
"keywords": ["net", "buffer", "protobuf", "serialization", "bytebuffer", "websocket", "webrtc"],
|
|
12
12
|
"ignore": [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "google.protobuf",
|
|
3
|
+
"syntax": "proto2",
|
|
3
4
|
"options": {
|
|
4
5
|
"java_package": "com.google.protobuf",
|
|
5
6
|
"java_outer_classname": "DescriptorProtos",
|
|
@@ -8,6 +9,7 @@
|
|
|
8
9
|
"messages": [
|
|
9
10
|
{
|
|
10
11
|
"name": "FileDescriptorSet",
|
|
12
|
+
"syntax": "proto2",
|
|
11
13
|
"fields": [
|
|
12
14
|
{
|
|
13
15
|
"rule": "repeated",
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
"name": "FileDescriptorProto",
|
|
24
|
+
"syntax": "proto2",
|
|
22
25
|
"fields": [
|
|
23
26
|
{
|
|
24
27
|
"rule": "optional",
|
|
@@ -90,6 +93,7 @@
|
|
|
90
93
|
},
|
|
91
94
|
{
|
|
92
95
|
"name": "DescriptorProto",
|
|
96
|
+
"syntax": "proto2",
|
|
93
97
|
"fields": [
|
|
94
98
|
{
|
|
95
99
|
"rule": "optional",
|
|
@@ -137,6 +141,7 @@
|
|
|
137
141
|
"messages": [
|
|
138
142
|
{
|
|
139
143
|
"name": "ExtensionRange",
|
|
144
|
+
"syntax": "proto2",
|
|
140
145
|
"fields": [
|
|
141
146
|
{
|
|
142
147
|
"rule": "optional",
|
|
@@ -156,6 +161,7 @@
|
|
|
156
161
|
},
|
|
157
162
|
{
|
|
158
163
|
"name": "FieldDescriptorProto",
|
|
164
|
+
"syntax": "proto2",
|
|
159
165
|
"fields": [
|
|
160
166
|
{
|
|
161
167
|
"rule": "optional",
|
|
@@ -209,6 +215,7 @@
|
|
|
209
215
|
"enums": [
|
|
210
216
|
{
|
|
211
217
|
"name": "Type",
|
|
218
|
+
"syntax": "proto2",
|
|
212
219
|
"values": [
|
|
213
220
|
{
|
|
214
221
|
"name": "TYPE_DOUBLE",
|
|
@@ -286,6 +293,7 @@
|
|
|
286
293
|
},
|
|
287
294
|
{
|
|
288
295
|
"name": "Label",
|
|
296
|
+
"syntax": "proto2",
|
|
289
297
|
"values": [
|
|
290
298
|
{
|
|
291
299
|
"name": "LABEL_OPTIONAL",
|
|
@@ -305,6 +313,7 @@
|
|
|
305
313
|
},
|
|
306
314
|
{
|
|
307
315
|
"name": "EnumDescriptorProto",
|
|
316
|
+
"syntax": "proto2",
|
|
308
317
|
"fields": [
|
|
309
318
|
{
|
|
310
319
|
"rule": "optional",
|
|
@@ -328,6 +337,7 @@
|
|
|
328
337
|
},
|
|
329
338
|
{
|
|
330
339
|
"name": "EnumValueDescriptorProto",
|
|
340
|
+
"syntax": "proto2",
|
|
331
341
|
"fields": [
|
|
332
342
|
{
|
|
333
343
|
"rule": "optional",
|
|
@@ -351,6 +361,7 @@
|
|
|
351
361
|
},
|
|
352
362
|
{
|
|
353
363
|
"name": "ServiceDescriptorProto",
|
|
364
|
+
"syntax": "proto2",
|
|
354
365
|
"fields": [
|
|
355
366
|
{
|
|
356
367
|
"rule": "optional",
|
|
@@ -374,6 +385,7 @@
|
|
|
374
385
|
},
|
|
375
386
|
{
|
|
376
387
|
"name": "MethodDescriptorProto",
|
|
388
|
+
"syntax": "proto2",
|
|
377
389
|
"fields": [
|
|
378
390
|
{
|
|
379
391
|
"rule": "optional",
|
|
@@ -403,6 +415,7 @@
|
|
|
403
415
|
},
|
|
404
416
|
{
|
|
405
417
|
"name": "FileOptions",
|
|
418
|
+
"syntax": "proto2",
|
|
406
419
|
"fields": [
|
|
407
420
|
{
|
|
408
421
|
"rule": "optional",
|
|
@@ -484,12 +497,15 @@
|
|
|
484
497
|
}
|
|
485
498
|
],
|
|
486
499
|
"extensions": [
|
|
487
|
-
|
|
488
|
-
|
|
500
|
+
[
|
|
501
|
+
1000,
|
|
502
|
+
536870911
|
|
503
|
+
]
|
|
489
504
|
],
|
|
490
505
|
"enums": [
|
|
491
506
|
{
|
|
492
507
|
"name": "OptimizeMode",
|
|
508
|
+
"syntax": "proto2",
|
|
493
509
|
"values": [
|
|
494
510
|
{
|
|
495
511
|
"name": "SPEED",
|
|
@@ -509,6 +525,7 @@
|
|
|
509
525
|
},
|
|
510
526
|
{
|
|
511
527
|
"name": "MessageOptions",
|
|
528
|
+
"syntax": "proto2",
|
|
512
529
|
"fields": [
|
|
513
530
|
{
|
|
514
531
|
"rule": "optional",
|
|
@@ -536,12 +553,15 @@
|
|
|
536
553
|
}
|
|
537
554
|
],
|
|
538
555
|
"extensions": [
|
|
539
|
-
|
|
540
|
-
|
|
556
|
+
[
|
|
557
|
+
1000,
|
|
558
|
+
536870911
|
|
559
|
+
]
|
|
541
560
|
]
|
|
542
561
|
},
|
|
543
562
|
{
|
|
544
563
|
"name": "FieldOptions",
|
|
564
|
+
"syntax": "proto2",
|
|
545
565
|
"fields": [
|
|
546
566
|
{
|
|
547
567
|
"rule": "optional",
|
|
@@ -599,12 +619,15 @@
|
|
|
599
619
|
}
|
|
600
620
|
],
|
|
601
621
|
"extensions": [
|
|
602
|
-
|
|
603
|
-
|
|
622
|
+
[
|
|
623
|
+
1000,
|
|
624
|
+
536870911
|
|
625
|
+
]
|
|
604
626
|
],
|
|
605
627
|
"enums": [
|
|
606
628
|
{
|
|
607
629
|
"name": "CType",
|
|
630
|
+
"syntax": "proto2",
|
|
608
631
|
"values": [
|
|
609
632
|
{
|
|
610
633
|
"name": "STRING",
|
|
@@ -624,6 +647,7 @@
|
|
|
624
647
|
},
|
|
625
648
|
{
|
|
626
649
|
"name": "EnumOptions",
|
|
650
|
+
"syntax": "proto2",
|
|
627
651
|
"fields": [
|
|
628
652
|
{
|
|
629
653
|
"rule": "optional",
|
|
@@ -642,12 +666,15 @@
|
|
|
642
666
|
}
|
|
643
667
|
],
|
|
644
668
|
"extensions": [
|
|
645
|
-
|
|
646
|
-
|
|
669
|
+
[
|
|
670
|
+
1000,
|
|
671
|
+
536870911
|
|
672
|
+
]
|
|
647
673
|
]
|
|
648
674
|
},
|
|
649
675
|
{
|
|
650
676
|
"name": "EnumValueOptions",
|
|
677
|
+
"syntax": "proto2",
|
|
651
678
|
"fields": [
|
|
652
679
|
{
|
|
653
680
|
"rule": "repeated",
|
|
@@ -657,12 +684,15 @@
|
|
|
657
684
|
}
|
|
658
685
|
],
|
|
659
686
|
"extensions": [
|
|
660
|
-
|
|
661
|
-
|
|
687
|
+
[
|
|
688
|
+
1000,
|
|
689
|
+
536870911
|
|
690
|
+
]
|
|
662
691
|
]
|
|
663
692
|
},
|
|
664
693
|
{
|
|
665
694
|
"name": "ServiceOptions",
|
|
695
|
+
"syntax": "proto2",
|
|
666
696
|
"fields": [
|
|
667
697
|
{
|
|
668
698
|
"rule": "repeated",
|
|
@@ -672,12 +702,15 @@
|
|
|
672
702
|
}
|
|
673
703
|
],
|
|
674
704
|
"extensions": [
|
|
675
|
-
|
|
676
|
-
|
|
705
|
+
[
|
|
706
|
+
1000,
|
|
707
|
+
536870911
|
|
708
|
+
]
|
|
677
709
|
]
|
|
678
710
|
},
|
|
679
711
|
{
|
|
680
712
|
"name": "MethodOptions",
|
|
713
|
+
"syntax": "proto2",
|
|
681
714
|
"fields": [
|
|
682
715
|
{
|
|
683
716
|
"rule": "repeated",
|
|
@@ -687,12 +720,15 @@
|
|
|
687
720
|
}
|
|
688
721
|
],
|
|
689
722
|
"extensions": [
|
|
690
|
-
|
|
691
|
-
|
|
723
|
+
[
|
|
724
|
+
1000,
|
|
725
|
+
536870911
|
|
726
|
+
]
|
|
692
727
|
]
|
|
693
728
|
},
|
|
694
729
|
{
|
|
695
730
|
"name": "UninterpretedOption",
|
|
731
|
+
"syntax": "proto2",
|
|
696
732
|
"fields": [
|
|
697
733
|
{
|
|
698
734
|
"rule": "repeated",
|
|
@@ -740,6 +776,7 @@
|
|
|
740
776
|
"messages": [
|
|
741
777
|
{
|
|
742
778
|
"name": "NamePart",
|
|
779
|
+
"syntax": "proto2",
|
|
743
780
|
"fields": [
|
|
744
781
|
{
|
|
745
782
|
"rule": "required",
|
|
@@ -759,6 +796,7 @@
|
|
|
759
796
|
},
|
|
760
797
|
{
|
|
761
798
|
"name": "SourceCodeInfo",
|
|
799
|
+
"syntax": "proto2",
|
|
762
800
|
"fields": [
|
|
763
801
|
{
|
|
764
802
|
"rule": "repeated",
|
|
@@ -770,6 +808,7 @@
|
|
|
770
808
|
"messages": [
|
|
771
809
|
{
|
|
772
810
|
"name": "Location",
|
|
811
|
+
"syntax": "proto2",
|
|
773
812
|
"fields": [
|
|
774
813
|
{
|
|
775
814
|
"rule": "repeated",
|
|
@@ -805,5 +844,6 @@
|
|
|
805
844
|
}
|
|
806
845
|
]
|
|
807
846
|
}
|
|
808
|
-
]
|
|
847
|
+
],
|
|
848
|
+
"isNamespace": true
|
|
809
849
|
}
|
|
File without changes
|
package/src/wrap.js
CHANGED
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @license
|
|
18
|
+
* @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
19
19
|
* Released under the Apache License, Version 2.0
|
|
20
|
-
* see: https://github.com/dcodeIO/
|
|
20
|
+
* see: https://github.com/dcodeIO/protobuf.js for details
|
|
21
21
|
*/
|
|
22
22
|
(function(global, factory) {
|
|
23
23
|
|
|
24
24
|
/* AMD */ if (typeof define === 'function' && define["amd"])
|
|
25
|
-
define(["
|
|
25
|
+
define(["bytebuffer"], factory);
|
|
26
26
|
/* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
|
|
27
27
|
module["exports"] = factory(require("bytebuffer"), true);
|
|
28
28
|
/* Global */ else
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
})(this, function(ByteBuffer, isCommonJS) {
|
|
32
32
|
"use strict";
|
|
33
33
|
|
|
34
|
-
//? include("
|
|
34
|
+
//? include("protobuf.js");
|
|
35
35
|
|
|
36
36
|
return ProtoBuf;
|
|
37
37
|
});
|