Skip to content

Commit a017bf8

Browse files
committed
Breaking: Dropped IE8 support; New: Converters use code generation and support custom implementations; CLI: Generated static code now supports asJSON/from
1 parent 39bc103 commit a017bf8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+10682
-5263
lines changed

.zuul.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ browsers:
99
- name: safari
1010
version: [5, latest]
1111
- name: ie
12-
version: [8, 9, 10, 11]
12+
version: [9, 10, 11]
1313
- name: opera
1414
version: [11, 12]
1515
- name: android

CHANGELOG.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1-
# [6.3.2](https://github.com/dcodeIO/protobuf.js/releases/tag/6.3.2)
1+
# [6.4.0](https://github.com/dcodeIO/protobuf.js/releases/tag/6.4.0)
2+
3+
## Breaking
4+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/39bc1031bb502f8b677b3736dd283736ea4d92c1) Removed now unused util.longNeq which was used by early static code<br />
25

36
## Fixed
47
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/7eb3d456370d7d66b0856e32b2d2602abf598516) Respect optional properties when writing interfaces in tsd-jsdoc, fixes [#598](https://github.com/dcodeIO/protobuf.js/issues/598)<br />
58

69
## New
10+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/28ce07d9812f5e1743afef95a94532d2c9488a84) Be more verbose when throwing invalid wire type errors, see [#602](https://github.com/dcodeIO/protobuf.js/issues/602)<br />
11+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/40074bb69c3ca4fcefe09d4cfe01f3a86844a7e8) Added an asJSON-option to always populate array fields, even if defaults=false, see [#597](https://github.com/dcodeIO/protobuf.js/issues/597)<br />
12+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a7d23240a278aac0bf01767b6096d692c09ae1ce) Attempt to improve TypeScript support by using explicit exports<br />
13+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/cec253fb9a177ac810ec96f4f87186506091fa37) Copy-pasted typescript definitions to micro modules, see [#599](https://github.com/dcodeIO/protobuf.js/issues/599)<br />
714
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/1f18453c7bfcce65c258fa98a3e3d4577d2e550f) Emit an error on resolveAll() if any extension fields cannot be resolved, see [#595](https://github.com/dcodeIO/protobuf.js/issues/595) + test case<br />
815

916
## CLI
17+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/3c775535517b8385a1d3c1bf056f3da3b4266f8c) Added support for TypeScript enums to pbts<br />
18+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/0cda72a55a1f2567a5d981dc5d924e55b8070513) Added a few helpful comments to static code<br />
19+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/24b293c297feff8bda5ee7a2f8f3f83d77c156d0) Slightly beautify statically generated code<br />
20+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/65637ffce20099df97ffbcdce50faccc8e97c366) Do not wrap main definition as a module and export directly instead<br />
21+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/65637ffce20099df97ffbcdce50faccc8e97c366) Generate prettier definitions with --no-comments<br />
22+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/20d8a2dd93d3bbb6990594286f992e703fc4e334) Added variable arguments support to tsd-jsdoc<br />
23+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/8493dbd9a923693e943f710918937d83ae3c4572) Reference dependency imports as a module to prevent name collisions, see [#596](https://github.com/dcodeIO/protobuf.js/issues/596)<br />
1024
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/39a2ea361c50d7f4aaa0408a0d55bb13823b906c) Removed now unnecessary comment lines in generated static code<br />
1125

1226
## Other
27+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/805291086f6212d1f108b3d8f36325cf1739c0bd) Reverted previous attempt on [#597](https://github.com/dcodeIO/protobuf.js/issues/597)<br />
28+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/c5160217ea95996375460c5403dfe37b913d392e) Minor tsd-jsdoc refactor<br />
29+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/961dd03061fc2c43ab3bf22b3f9f5165504c1002) Removed unused sandbox files<br />
30+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/f625eb8b0762f8f5d35bcd5fc445e52b92d8e77d) Updated package.json of micro modules to reference types, see [#599](https://github.com/dcodeIO/protobuf.js/issues/599)<br />
1331
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/46ec8209b21cf9ff09ae8674e2a5bbc49fd4991b) Reference dependencies as imports in generated typescript definitions, see [#596](https://github.com/dcodeIO/protobuf.js/issues/596)<br />
1432
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/c0ab94c2e469c0fbf790e4807f24fddd6370e342) Reference dependencies as imports in generated typescript definitions, see [#596](https://github.com/dcodeIO/protobuf.js/issues/596)<br />
1533
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/3bab132b871798c7c50c60a4c14c2effdffa372e) Allow null values on optional long fields, see [#590](https://github.com/dcodeIO/protobuf.js/issues/590)<br />

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ Compatibility
541541

542542
* Because the internals of this package do not rely on `google/protobuf/descriptor.proto`, options are parsed and presented literally.
543543
* If typed arrays are not supported by the environment, plain arrays will be used instead.
544-
* Support for pre-ES5 environments like IE8 can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js) and, instead of using property getters and setters on reflection objects, calling the respective functions prefixed with `get`, `set` or `is` directly (i.e. calling `Type#getFieldsById()` instead of accessing `Type#fieldsById`). Note that this also applies to virtual oneof properties (use `getKind`, `setKind` for example if the oneof is named `kind`).
544+
* Support for pre-ES5 environments (except IE8) can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js).
545545
* If you need a proper way to work with 64 bit values (uint64, int64 etc.), you can install [long.js](https://github.com/dcodeIO/long.js) alongside this library. All 64 bit numbers will then be returned as a `Long` instance instead of a possibly unsafe JavaScript number ([see](https://github.com/dcodeIO/long.js)).
546546

547547
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)

cli/pbjs.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ exports.main = function(args, callback) {
2626
root : "r"
2727
},
2828
string: [ "target", "out", "path", "wrap", "root" ],
29-
boolean: [ "keep-case", "create", "encode", "decode", "verify", "delimited" ],
29+
boolean: [ "keep-case", "create", "encode", "decode", "verify", "convert", "delimited", "beautify", "comments" ],
3030
default: {
31-
target: "json",
32-
create: true,
33-
encode: true,
34-
decode: true,
35-
verify: true,
36-
delimited: true
31+
target : "json",
32+
create : true,
33+
encode : true,
34+
decode : true,
35+
verify : true,
36+
convert : true,
37+
delimited : true,
38+
beautify : true,
39+
comments : true
3740
}
3841
});
3942

@@ -81,7 +84,10 @@ exports.main = function(args, callback) {
8184
" --no-encode Does not generate encode functions.",
8285
" --no-decode Does not generate decode functions.",
8386
" --no-verify Does not generate verify functions.",
87+
" --no-convert Does not generate convert functions like asJSON and from.",
8488
" --no-delimited Does not generate delimited encode/decode functions.",
89+
" --no-beautify Does not beautify generated code.",
90+
" --no-comments Does not output any JSDoc comments.",
8591
"",
8692
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..."
8793
].join("\n"));

0 commit comments

Comments
 (0)