Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

protobufjs

protobufjs68.3mBSD-3-Clause7.4.0TypeScript support: included

Protocol Buffers for JavaScript (& TypeScript).

protobuf, protocol-buffers, serialization, typescript

readme

protobuf.js
protobuf.js

Protocol Buffers are a language-neutral, platform-neutral, extensible way of serializing structured data for use in communications protocols, data storage, and more, originally designed at Google (see).

protobuf.js is a pure JavaScript implementation with TypeScript support for Node.js and the browser. It's easy to use, does not sacrifice on performance, has good conformance and works out of the box with .proto files!

Contents

Installation

Node.js

npm install protobufjs --save
// Static code + Reflection + .proto parser
var protobuf = require("protobufjs");

// Static code + Reflection
var protobuf = require("protobufjs/light");

// Static code only
var protobuf = require("protobufjs/minimal");

The optional command line utility to generate static code and reflection bundles lives in the protobufjs-cli package and can be installed separately:

npm install protobufjs-cli --save-dev

Browsers

Pick the variant matching your needs and replace the version tag with the exact release your project depends upon. For example, to use the minified full variant:

<script src="//cdn.jsdelivr.net/npm/protobufjs@7.X.X/dist/protobuf.min.js"></script>
Distribution Location
Full https://cdn.jsdelivr.net/npm/protobufjs/dist/
Light https://cdn.jsdelivr.net/npm/protobufjs/dist/light/
Minimal https://cdn.jsdelivr.net/npm/protobufjs/dist/minimal/

All variants support CommonJS and AMD loaders and export globally as window.protobuf.

Usage

Because JavaScript is a dynamically typed language, protobuf.js utilizes the concept of a valid message in order to provide the best possible performance (and, as a side product, proper typings):

Valid message

A valid message is an object (1) not missing any required fields and (2) exclusively composed of JS types understood by the wire format writer.

There are two possible types of valid messages and the encoder is able to work with both of these for convenience:

  • Message instances (explicit instances of message classes with default values on their prototype) naturally satisfy the requirements of a valid message and
  • Plain JavaScript objects that just so happen to be composed in a way satisfying the requirements of a valid message as well.

In a nutshell, the wire format writer understands the following types:

Field type Expected JS type (create, encode) Conversion (fromObject)
s-/u-/int32
s-/fixed32
number (32 bit integer) value | 0 if signed
value >>> 0 if unsigned
s-/u-/int64
s-/fixed64
Long-like (optimal)
number (53 bit integer)
Long.fromValue(value) with long.js
parseInt(value, 10) otherwise
float
double
number Number(value)
bool boolean Boolean(value)
string string String(value)
bytes Uint8Array (optimal)
Buffer (optimal under node)
Array.<number> (8 bit integers)
base64.decode(value) if a string
Object with non-zero .length is assumed to be buffer-like
enum number (32 bit integer) Looks up the numeric id if a string
message Valid message Message.fromObject(value)
repeated T Array<T> Copy
map<K, V> Object<K,V> Copy
  • Explicit undefined and null are considered as not set if the field is optional.
  • Maps are objects where the key is the string representation of the respective value or an 8 characters long hash string for Long-likes.

Toolset

With that in mind and again for performance reasons, each message class provides a distinct set of methods with each method doing just one thing. This avoids unnecessary assertions / redundant operations where performance is a concern but also forces a user to perform verification (of plain JavaScript objects that might just so happen to be a valid message) explicitly where necessary - for example when dealing with user input.

Note that Message below refers to any message class.

  • Message.verify(message: Object): null|string
    verifies that a plain JavaScript object satisfies the requirements of a valid message and thus can be encoded without issues. Instead of throwing, it returns the error message as a string, if any.

    var payload = "invalid (not an object)";
    var err = AwesomeMessage.verify(payload);
    if (err)
      throw Error(err);
  • Message.encode(message: Message|Object [, writer: Writer]): Writer
    encodes a message instance or valid plain JavaScript object. This method does not implicitly verify the message and it's up to the user to make sure that the payload is a valid message.

    var buffer = AwesomeMessage.encode(message).finish();
  • Message.encodeDelimited(message: Message|Object [, writer: Writer]): Writer
    works like Message.encode but additionally prepends the length of the message as a varint.

  • Message.decode(reader: Reader|Uint8Array): Message
    decodes a buffer to a message instance. If required fields are missing, it throws a util.ProtocolError with an instance property set to the so far decoded message. If the wire format is invalid, it throws an Error.

    try {
      var decodedMessage = AwesomeMessage.decode(buffer);
    } catch (e) {
        if (e instanceof protobuf.util.ProtocolError) {
          // e.instance holds the so far decoded message with missing required fields
        } else {
          // wire format is invalid
        }
    }
  • Message.decodeDelimited(reader: Reader|Uint8Array): Message
    works like Message.decode but additionally reads the length of the message prepended as a varint.

  • Message.create(properties: Object): Message
    creates a new message instance from a set of properties that satisfy the requirements of a valid message. Where applicable, it is recommended to prefer Message.create over Message.fromObject because it doesn't perform possibly redundant conversion.

    var message = AwesomeMessage.create({ awesomeField: "AwesomeString" });
  • Message.fromObject(object: Object): Message
    converts any non-valid plain JavaScript object to a message instance using the conversion steps outlined within the table above.

    var message = AwesomeMessage.fromObject({ awesomeField: 42 });
    // converts awesomeField to a string
  • Message.toObject(message: Message [, options: ConversionOptions]): Object
    converts a message instance to an arbitrary plain JavaScript object for interoperability with other libraries or storage. The resulting plain JavaScript object might still satisfy the requirements of a valid message depending on the actual conversion options specified, but most of the time it does not.

    var object = AwesomeMessage.toObject(message, {
      enums: String,  // enums as string names
      longs: String,  // longs as strings (requires long.js)
      bytes: String,  // bytes as base64 encoded strings
      defaults: true, // includes default values
      arrays: true,   // populates empty arrays (repeated fields) even if defaults=false
      objects: true,  // populates empty objects (map fields) even if defaults=false
      oneofs: true    // includes virtual oneof fields set to the present field's name
    });

For reference, the following diagram aims to display relationships between the different methods and the concept of a valid message:

Toolset Diagram

In other words: verify indicates that calling create or encode directly on the plain object will [result in a valid message respectively] succeed. fromObject, on the other hand, does conversion from a broader range of plain objects to create valid messages. (ref)

Examples

Using .proto files

It is possible to load existing .proto files using the full library, which parses and compiles the definitions to ready to use (reflection-based) message classes:

// awesome.proto
package awesomepackage;
syntax = "proto3";

message AwesomeMessage {
    string awesome_field = 1; // becomes awesomeField
}
protobuf.load("awesome.proto", function(err, root) {
    if (err)
        throw err;

    // Obtain a message type
    var AwesomeMessage = root.lookupType("awesomepackage.AwesomeMessage");

    // Exemplary payload
    var payload = { awesomeField: "AwesomeString" };

    // Verify the payload if necessary (i.e. when possibly incomplete or invalid)
    var errMsg = AwesomeMessage.verify(payload);
    if (errMsg)
        throw Error(errMsg);

    // Create a new message
    var message = AwesomeMessage.create(payload); // or use .fromObject if conversion is necessary

    // Encode a message to an Uint8Array (browser) or Buffer (node)
    var buffer = AwesomeMessage.encode(message).finish();
    // ... do something with buffer

    // Decode an Uint8Array (browser) or Buffer (node) to a message
    var message = AwesomeMessage.decode(buffer);
    // ... do something with message

    // If the application uses length-delimited buffers, there is also encodeDelimited and decodeDelimited.

    // Maybe convert the message back to a plain object
    var object = AwesomeMessage.toObject(message, {
        longs: String,
        enums: String,
        bytes: String,
        // see ConversionOptions
    });
});

Additionally, promise syntax can be used by omitting the callback, if preferred:

protobuf.load("awesome.proto")
    .then(function(root) {
       ...
    });

Using JSON descriptors

The library utilizes JSON descriptors that are equivalent to a .proto definition. For example, the following is identical to the .proto definition seen above:

// awesome.json
{
  "nested": {
    "awesomepackage": {
      "nested": {
        "AwesomeMessage": {
          "fields": {
            "awesomeField": {
              "type": "string",
              "id": 1
            }
          }
        }
      }
    }
  }
}

JSON descriptors closely resemble the internal reflection structure:

Type (T) Extends Type-specific properties
ReflectionObject | options
Namespace ReflectionObject nested
Root Namespace nested
Type Namespace fields
Enum ReflectionObject values
Field ReflectionObject rule, type, id
MapField Field keyType
OneOf ReflectionObject oneof (array of field names)
Service Namespace methods
Method ReflectionObject type, requestType, responseType, requestStream, responseStream
  • Bold properties are required. Italic types are abstract.
  • T.fromJSON(name, json) creates the respective reflection object from a JSON descriptor
  • T#toJSON() creates a JSON descriptor from the respective reflection object (its name is used as the key within the parent)

Exclusively using JSON descriptors instead of .proto files enables the use of just the light library (the parser isn't required in this case).

A JSON descriptor can either be loaded the usual way:

protobuf.load("awesome.json", function(err, root) {
    if (err) throw err;

    // Continue at "Obtain a message type" above
});

Or it can be loaded inline:

var jsonDescriptor = require("./awesome.json"); // exemplary for node

var root = protobuf.Root.fromJSON(jsonDescriptor);

// Continue at "Obtain a message type" above

Using reflection only

Both the full and the light library include full reflection support. One could, for example, define the .proto definitions seen in the examples above using just reflection:

...
var Root  = protobuf.Root,
    Type  = protobuf.Type,
    Field = protobuf.Field;

var AwesomeMessage = new Type("AwesomeMessage").add(new Field("awesomeField", 1, "string"));

var root = new Root().define("awesomepackage").add(AwesomeMessage);

// Continue at "Create a new message" above
...

Detailed information on the reflection structure is available within the API documentation.

Using custom classes

Message classes can also be extended with custom functionality and it is also possible to register a custom constructor with a reflected message type:

...

// Define a custom constructor
function AwesomeMessage(properties) {
    // custom initialization code
    ...
}

// Register the custom constructor with its reflected type (*)
root.lookupType("awesomepackage.AwesomeMessage").ctor = AwesomeMessage;

// Define custom functionality
AwesomeMessage.customStaticMethod = function() { ... };
AwesomeMessage.prototype.customInstanceMethod = function() { ... };

// Continue at "Create a new message" above

(*) Besides referencing its reflected type through AwesomeMessage.$type and AwesomeMesage#$type, the respective custom class is automatically populated with:

  • AwesomeMessage.create
  • AwesomeMessage.encode and AwesomeMessage.encodeDelimited
  • AwesomeMessage.decode and AwesomeMessage.decodeDelimited
  • AwesomeMessage.verify
  • AwesomeMessage.fromObject, AwesomeMessage.toObject and AwesomeMessage#toJSON

Afterwards, decoded messages of this type are instanceof AwesomeMessage.

Alternatively, it is also possible to reuse and extend the internal constructor if custom initialization code is not required:

...

// Reuse the internal constructor
var AwesomeMessage = root.lookupType("awesomepackage.AwesomeMessage").ctor;

// Define custom functionality
AwesomeMessage.customStaticMethod = function() { ... };
AwesomeMessage.prototype.customInstanceMethod = function() { ... };

// Continue at "Create a new message" above

Using services

The library also supports consuming services but it doesn't make any assumptions about the actual transport channel. Instead, a user must provide a suitable RPC implementation, which is an asynchronous function that takes the reflected service method, the binary request and a node-style callback as its parameters:

function rpcImpl(method, requestData, callback) {
    // perform the request using an HTTP request or a WebSocket for example
    var responseData = ...;
    // and call the callback with the binary response afterwards:
    callback(null, responseData);
}

Below is a working example with a typescript implementation using grpc npm package.

const grpc = require('grpc')

const Client = grpc.makeGenericClientConstructor({})
const client = new Client(
  grpcServerUrl,
  grpc.credentials.createInsecure()
)

const rpcImpl = function(method, requestData, callback) {
  client.makeUnaryRequest(
    method.name,
    arg => arg,
    arg => arg,
    requestData,
    callback
  )
}

Example:

// greeter.proto
syntax = "proto3";

service Greeter {
    rpc SayHello (HelloRequest) returns (HelloReply) {}
}

message HelloRequest {
    string name = 1;
}

message HelloReply {
    string message = 1;
}
...
var Greeter = root.lookup("Greeter");
var greeter = Greeter.create(/* see above */ rpcImpl, /* request delimited? */ false, /* response delimited? */ false);

greeter.sayHello({ name: 'you' }, function(err, response) {
    console.log('Greeting:', response.message);
});

Services also support promises:

greeter.sayHello({ name: 'you' })
    .then(function(response) {
        console.log('Greeting:', response.message);
    });

There is also an example for streaming RPC.

Note that the service API is meant for clients. Implementing a server-side endpoint pretty much always requires transport channel (i.e. http, websocket, etc.) specific code with the only common denominator being that it decodes and encodes messages.

Usage with TypeScript

The library ships with its own type definitions and modern editors like Visual Studio Code will automatically detect and use them for code completion.

The npm package depends on @types/node because of Buffer and @types/long because of Long. If you are not building for node and/or not using long.js, it should be safe to exclude them manually.

Using the JS API

The API shown above works pretty much the same with TypeScript. However, because everything is typed, accessing fields on instances of dynamically generated message classes requires either using bracket-notation (i.e. message["awesomeField"]) or explicit casts. Alternatively, it is possible to use a typings file generated for its static counterpart.

import { load } from "protobufjs"; // respectively "./node_modules/protobufjs"

load("awesome.proto", function(err, root) {
  if (err)
    throw err;

  // example code
  const AwesomeMessage = root.lookupType("awesomepackage.AwesomeMessage");

  let message = AwesomeMessage.create({ awesomeField: "hello" });
  console.log(`message = ${JSON.stringify(message)}`);

  let buffer = AwesomeMessage.encode(message).finish();
  console.log(`buffer = ${Array.prototype.toString.call(buffer)}`);

  let decoded = AwesomeMessage.decode(buffer);
  console.log(`decoded = ${JSON.stringify(decoded)}`);
});

Using generated static code

If you generated static code to bundle.js using the CLI and its type definitions to bundle.d.ts, then you can just do:

import { AwesomeMessage } from "./bundle.js";

// example code
let message = AwesomeMessage.create({ awesomeField: "hello" });
let buffer  = AwesomeMessage.encode(message).finish();
let decoded = AwesomeMessage.decode(buffer);

Using decorators

The library also includes an early implementation of decorators.

Note that decorators are an experimental feature in TypeScript and that declaration order is important depending on the JS target. For example, `@Field.d(2, AwesomeArrayMessage)requires thatAwesomeArrayMessagehas been defined earlier when targetingES5`.

import { Message, Type, Field, OneOf } from "protobufjs/light"; // respectively "./node_modules/protobufjs/light.js"

export class AwesomeSubMessage extends Message<AwesomeSubMessage> {

  @Field.d(1, "string")
  public awesomeString: string;

}

export enum AwesomeEnum {
  ONE = 1,
  TWO = 2
}

@Type.d("SuperAwesomeMessage")
export class AwesomeMessage extends Message<AwesomeMessage> {

  @Field.d(1, "string", "optional", "awesome default string")
  public awesomeField: string;

  @Field.d(2, AwesomeSubMessage)
  public awesomeSubMessage: AwesomeSubMessage;

  @Field.d(3, AwesomeEnum, "optional", AwesomeEnum.ONE)
  public awesomeEnum: AwesomeEnum;

  @OneOf.d("awesomeSubMessage", "awesomeEnum")
  public which: string;

}

// example code
let message = new AwesomeMessage({ awesomeField: "hello" });
let buffer  = AwesomeMessage.encode(message).finish();
let decoded = AwesomeMessage.decode(buffer);

Supported decorators are:

  • Type.d(typeName?: string)   (optional)
    annotates a class as a protobuf message type. If typeName is not specified, the constructor's runtime function name is used for the reflected type.

  • Field.d<T>(fieldId: number, fieldType: string | Constructor<T>, fieldRule?: "optional" | "required" | "repeated", defaultValue?: T)
    annotates a property as a protobuf field with the specified id and protobuf type.

  • MapField.d<T extends { [key: string]: any }>(fieldId: number, fieldKeyType: string, fieldValueType. string | Constructor<{}>)
    annotates a property as a protobuf map field with the specified id, protobuf key and value type.

  • OneOf.d<T extends string>(...fieldNames: string[])
    annotates a property as a protobuf oneof covering the specified fields.

Other notes:

  • Decorated types reside in protobuf.roots["decorated"] using a flat structure, so no duplicate names.
  • Enums are copied to a reflected enum with a generic name on decorator evaluation because referenced enum objects have no runtime name the decorator could use.
  • Default values must be specified as arguments to the decorator instead of using a property initializer for proper prototype behavior.
  • Property names on decorated classes must not be renamed on compile time (i.e. by a minifier) because decorators just receive the original field name as a string.

ProTip! Not as pretty, but you can use decorators in plain JavaScript as well.

Additional documentation

Protocol Buffers

protobuf.js

Community

Performance

The package includes a benchmark that compares protobuf.js performance to native JSON (as far as this is possible) and Google's JS implementation. On an i7-2600K running node 6.9.1 it yields:

benchmarking encoding performance ...

protobuf.js (reflect) x 541,707 ops/sec ±1.13% (87 runs sampled)
protobuf.js (static) x 548,134 ops/sec ±1.38% (89 runs sampled)
JSON (string) x 318,076 ops/sec ±0.63% (93 runs sampled)
JSON (buffer) x 179,165 ops/sec ±2.26% (91 runs sampled)
google-protobuf x 74,406 ops/sec ±0.85% (86 runs sampled)

   protobuf.js (static) was fastest
  protobuf.js (reflect) was 0.9% ops/sec slower (factor 1.0)
          JSON (string) was 41.5% ops/sec slower (factor 1.7)
          JSON (buffer) was 67.6% ops/sec slower (factor 3.1)
        google-protobuf was 86.4% ops/sec slower (factor 7.3)

benchmarking decoding performance ...

protobuf.js (reflect) x 1,383,981 ops/sec ±0.88% (93 runs sampled)
protobuf.js (static) x 1,378,925 ops/sec ±0.81% (93 runs sampled)
JSON (string) x 302,444 ops/sec ±0.81% (93 runs sampled)
JSON (buffer) x 264,882 ops/sec ±0.81% (93 runs sampled)
google-protobuf x 179,180 ops/sec ±0.64% (94 runs sampled)

  protobuf.js (reflect) was fastest
   protobuf.js (static) was 0.3% ops/sec slower (factor 1.0)
          JSON (string) was 78.1% ops/sec slower (factor 4.6)
          JSON (buffer) was 80.8% ops/sec slower (factor 5.2)
        google-protobuf was 87.0% ops/sec slower (factor 7.7)

benchmarking combined performance ...

protobuf.js (reflect) x 275,900 ops/sec ±0.78% (90 runs sampled)
protobuf.js (static) x 290,096 ops/sec ±0.96% (90 runs sampled)
JSON (string) x 129,381 ops/sec ±0.77% (90 runs sampled)
JSON (buffer) x 91,051 ops/sec ±0.94% (90 runs sampled)
google-protobuf x 42,050 ops/sec ±0.85% (91 runs sampled)

   protobuf.js (static) was fastest
  protobuf.js (reflect) was 4.7% ops/sec slower (factor 1.0)
          JSON (string) was 55.3% ops/sec slower (factor 2.2)
          JSON (buffer) was 68.6% ops/sec slower (factor 3.2)
        google-protobuf was 85.5% ops/sec slower (factor 6.9)

These results are achieved by

  • generating type-specific encoders, decoders, verifiers and converters at runtime
  • configuring the reader/writer interface according to the environment
  • using node-specific functionality where beneficial and, of course
  • avoiding unnecessary operations through splitting up the toolset.

You can also run the benchmark ...

$> npm run bench

and the profiler yourself (the latter requires a recent version of node):

$> npm run prof <encode|decode|encode-browser|decode-browser> [iterations=10000000]

Note that as of this writing, the benchmark suite performs significantly slower on node 7.2.0 compared to 6.9.1 because moths.

Compatibility

  • Works in all modern and not-so-modern browsers except IE8.
  • Because the internals of this package do not rely on google/protobuf/descriptor.proto, options are parsed and presented literally.
  • If typed arrays are not supported by the environment, plain arrays will be used instead.
  • Support for pre-ES5 environments (except IE8) can be achieved by using a polyfill.
  • Support for Content Security Policy-restricted environments (like Chrome extensions without unsafe-eval) can be achieved by generating and using static code instead.
  • If a proper way to work with 64 bit values (uint64, int64 etc.) is required, just install 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).
  • For descriptor.proto interoperability, see ext/descriptor

Building

To build the library or its components yourself, clone it from GitHub and install the development dependencies:

$> git clone https://github.com/protobufjs/protobuf.js.git
$> cd protobuf.js
$> npm install

Building the respective development and production versions with their respective source maps to dist/:

$> npm run build

Building the documentation to docs/:

$> npm run docs

Building the TypeScript definition to index.d.ts:

$> npm run build:types

Browserify integration

By default, protobuf.js integrates into any browserify build-process without requiring any optional modules. Hence:

  • If int64 support is required, explicitly require the long module somewhere in your project as it will be excluded otherwise. This assumes that a global require function is present that protobuf.js can call to obtain the long module.

    If there is no global require function present after bundling, it's also possible to assign the long module programmatically:

    var Long = ...;
    
    protobuf.util.Long = Long;
    protobuf.configure();
  • If you have any special requirements, there is the bundler for reference.

License: BSD 3-Clause License

changelog

Changelog

7.4.0 (2024-08-22)

Features

  • Add prepublishOnly script (0e4da8b)

Bug Fixes

7.3.3 (2024-08-16)

Bug Fixes

  • handle nullability for optional fields (59569c1)

7.3.2 (2024-06-12)

Bug Fixes

  • docs: Update readme to correct command for creating types (#1939) (0f9d477)

7.3.1 (2024-06-05)

Bug Fixes

  • types: reserved field in IType can contain reserved names (#2001) (d1d2c0c)

7.3.0 (2024-05-10)

Features

  • add handling for extension range options (#1990) (2d58011)

7.2.6 (2024-01-16)

Bug Fixes

  • report missing import properly in loadSync (#1960) (af3ff83)

7.2.5 (2023-08-21)

Bug Fixes

7.2.4 (2023-06-23)

Bug Fixes

  • do not let setProperty change the prototype (#1899) (e66379f)

7.2.3 (2023-03-27)

Bug Fixes

  • type names can be split into multiple tokens (#1877) (8817ee6)

7.2.2 (2023-02-07)

Bug Fixes

  • do not allow to extend same field twice to prevent the error (#1784) (14f0536)

7.2.1 (2023-02-02)

Bug Fixes

  • cli: fix relative path to Google pb files (#1859) (e42eea4)
  • Revert "fix: error should be thrown" (4489fa7)
  • use bundled filename to fix common pb includes (#1860) (dce9a2e)
  • use ES5 style function syntax (#1830) (64e8936)

7.2.0 (2023-01-24)

Features

  • cli: generate static files at the granularity of proto messages (#1840) (32f2d6a)

Bug Fixes

7.1.2 (2022-09-22)

Bug Fixes

7.1.1 (2022-09-09)

Bug Fixes

  • add import long to the generated .d.ts (#1802) (7c27b5a)
  • generate valid js code for aliased enum values (#1801) (7120e93)

7.1.0 (2022-08-26)

Features

Bug Fixes

7.0.0 (2022-07-08)

⚠ BREAKING CHANGES

  • drop support for Node 4, 6, 8, 10 (#1764)
  • move command line tool to a new package named protobufjs-cli (#1234)
  • encoding of empty Buffers (#1514)

Features

Bug Fixes

6.10.2 (2020-11-13)

Bug Fixes

6.10.1 (2020-07-16)

Bug Fixes

  • make node detection a bit more forgiving (#1445) (4e75f6d)

6.10.0 (2020-07-13)

Features

Bug Fixes

6.9.0 (2020-04-17)

Features

Bug Fixes

  • allow file-level options everywhere in the file (b70eebd)
  • Import Long types (1d98cb8)
  • npm audit fixes (ca52447)
  • properly iterate and return method descriptors (d96bb7a)
  • run npm audit fix (#1208) (b5b6632)
  • docs: update CHANGELOG to match format of release-please (#1376) (15ed8a0)

6.8.8

Fixed

:hash: Persist recent index.d.ts changes in JSDoc

6.8.7

Fixed

:hash: Fix package browser field descriptor (#1046)
:hash: Fix static codegen issues with uglifyjs3
:hash: Fix lint issues / pbts on windows
:hash: Fix empty 'bytes' field decoding, now using Buffer where applicable (#1020)
:hash: Fix circular dependency of Namespace and Enum (#994)
:hash: Ignore optional commas in aggregate options (#999)

New

:hash: Make Message<T> have a default type param (#1086)
:hash: Explicitly define service method names when generating static code, see #857
:hash: Also handle services in ext/descriptor (#1001)

CLI

:hash: Extend list of ignored ESLint rules for pbjs, fixes #1085
:hash: Fix declared return type of pbjs/pbts callback (#1025)
:hash: Added an option to pbts to allow custom imports (#1038)
:hash: Get node executable path from process.execPath (#1018)

Other

:hash: Slim down CI testing and remove some not ultimately necesssary dependencies with audit issues
:hash: Move global handling to util, see #995

6.8.6

Fixed

:hash: Fix typeRefRe being vulnerable to ReDoS

6.8.5

New

:hash: Preserve comments when serializing/deserializing with toJSON and fromJSON. (#983)
:hash: Add more details to some frequent error messages (#962)
:hash: Add IParseOptions#alternateCommentMode (#968)
:hash: Added field_mask to built-in common wrappers (#982)

Other

:hash: Remove code climate config in order to use 'in-app' config instead

6.8.4

Other

:hash: Update jsdoc dependency (pinned vulnerable marked)

6.8.3

CLI

:hash: Use correct safeProp in json-module target, see #956

6.8.2

Other

:hash: Include dist files in npm package, see #955

6.8.1

Fixed

:hash: Prevent invalid JSDoc names when generating service methods, see #870
:hash: Prevent parse errors when generating service method names, see #870
:hash: Support parsing nested option-values with or without ':' (#951, fixes #946)
:hash: Add support for reserved keyword in enums (#950, fixes #949)
:hash: Unified safe property escapes and added a test for #834
:hash: Fix codegen if type name starts with "Object"
:hash: Fixed dependency for json-module to use "light".
:hash: Basic support for URL prefixes in google.protobuf.Any types.
:hash: fixed 'error is not defined linter warning when using static/static-module and es6
:hash: Fixed wrong type_url for any type (no leading '.' allowed).
:hash: Fixed fromObject() for google.protobuf.Any types.
:hash: Handle case where 'extendee' is undefined in ext/descriptor

CLI

:hash: Sanitize CR-only line endings (coming from jsdoc?)
:hash: Make sure enum typings become generated (#884 didn't solve this)
:hash: Remove exclude and include patterns from jsdoc config
:hash: Skip defaults when generating proto3
:hash: Wait for both the 'end' and 'close' event to happen before finishing in pbts, see #863
:hash: Accept null for optional fields in generated static code
:hash: Annotate TS classes with @implements
:hash: Annotate virtual oneofs as string literal unions

New

:hash: Also check for reserved ids and names in enums
:hash: Also support 'reserved' in enum descriptors

Other

:hash: Include just relevant files in npm package, fixes #781
:hash: Fix travis build

6.8.0

Breaking

:hash: Replaced Buffer and Long types with interfaces and removed stubs
:hash: Removed Message#toObject in favor of having just the static version (unnecessary static code otherwise)
:hash: Everything uses interfaces now instead of typedefs (SomethingProperties is now ISomething)
:hash: ReflectionObject#toJSON properly omits explicit undefined values
:hash: Initial implementation of TypeScript decorators
:hash: Refactored protobuf.Class away
:hash: TypeScript definitions now have (a lot of) generics
:hash: Removed deprecated features

Fixed

:hash: Added 'undefined' besides 'null' as a valid value of an optional field, fixes #826
:hash: Fixed an issue with codegen typings, see #819
:hash: Ported utf8 chunking mechanism to base64 as well, fixes #800
:hash: Also be more verbose when defining properties for ES6, fixes #820
:hash: Generate more verbose JSDoc comments for ES6 support, fixes #820
:hash: Emit a maximum of one error var when generating verifiers, fixes #786
:hash: Fixed missing semicolon after 'extensions' and 'reserved' when generating proto files, fixes #810
:hash: Call npm with '--no-bin-links' when installing CLI deps, fixes #823
:hash: Fix Reader argument conversion in static module
:hash: Use JSDoc, they said, it documents code, they said. Fixes #770
:hash: parser should not confuse previous trailing line comments with comments for the next declaration, see #762
:hash: Types should not clear constructor with cache (fixes decorators)
:hash: Namespace#lookup should also check in nested namespaces (wtf)
:hash: Reader#bytes should also support plain arrays
:hash: Fix markdown for pipe in code in table

New

:hash: Upgrade to codegen 2
:hash: ext/descriptor enables interoperability between reflection and descriptor.proto (experimental), see #757
:hash: Added 'json' conversion option for proto3 JSON mapping compatibility of NaN and Infinity + additional documentation of util.toJSONOptions, see #351

CLI

:hash: Use protobuf/minimal when pbjs target is static-module
:hash: Added closure wrapper
:hash: Various improvements to statically generated JSDoc, also fixes #772
:hash: Check incompatible properties for namespaces only in tsd-jsdoc
:hash: Additional tsd-jsdoc handling of properties inside of namespaces and TS specific API exposure
:hash: Several improvements to tsd-jsdoc emitted comments
:hash: Further TypeScript definition improvements
:hash: Relieved tsd files from unnecessary comments
:hash: Generate TS namespaces for vars and functions with properties
:hash: Prefer @tstype over @type when generating typedefs (tsd-jsdoc)

Docs

:hash: Replaced nullable types with explicit type|null for better tooling compatibility, also fixes #766 and fixes 767
:hash: Added more info to ext/descriptor README, see #757
:hash: Additional notes on ext/descriptor
:hash: Updated CHANGELOG so everyone knows what's going on (and soon, breaking)
:hash: Additional docs on TS/decorators usage

Other

:hash: Updated dist files
:hash: Added package-lock.json
:hash: Minor formatting
:hash: Generate files
:hash: Remove the no-constructor arg
:hash: Remove the ctor option.
:hash: Add support to generate types for JSON object.
:hash: aspromise performance pass
:hash: codegen 2 performance pass, #653 might benefit
:hash: Fixed minimal library including reflection functionality
:hash: Minor compression ratio tuning
:hash: Fixed failing test case + coverage
:hash: Improved fromObject wrapper for google.protobuf.Any.
:hash: Fixed failing tokenize test case
:hash: Removed debug build, made it an extension
:hash: Regenerated dist files
:hash: Even more documentation and typings for ext/descriptor
:hash: ext/descriptor docs
:hash: Decorators coverage
:hash: ext/descriptor support for various standard options, see #757
:hash: ext/descriptor passes descriptor.proto test with no differences, see #757
:hash: Properly remove unnecessary (packed) options from JSON descriptors
:hash: Use typedefs in ext/descriptor (like everywhere else), see #757
:hash: Fixed obvious issues with ext/descriptor, does not throw anymore when throwing descriptor.proto itself at it, see #757
:hash: Added still missing root traversal to ext/descriptor, see #757
:hash: Initial map fields support for ext/descriptor, see #757
:hash: Added infrastructure for TypeScript support of extensions
:hash: TypeScript generics improvements
:hash: More ext/descriptor progress, see #757
:hash: Just export the relevant namespace in ext/descriptor
:hash: Initial descriptor.proto extension for reflection interoperability, see #757
:hash: Moved custom wrappers to its own module instead, also makes the API easier to use manually, see #677
:hash: Added infrastructure for custom wrapping/unwrapping of special types, see #677
:hash: More decorator progress (MapField.d, optional Type.d)
:hash: tsd-jsdoc now has limited generics support

6.7.3

Other

:hash: long, @types/long and @types/node are just dependencies, see #753

6.7.2

New

:hash: Split up NamespaceDescriptor to make nested plain namespaces a thing, see #749

Docs

:hash: More README
:hash: Replaced 'runtime message' with 'message instance' for clarity
:hash: Rephrased the Usage section around the concept of valid messages
:hash: Added toolset diagram to README

Other

:hash: Touched benchmark output metrics once more
:hash: Fixed failing browser test
:hash: Output more human friendly metrics from benchmark
:hash: Stripped down static bench code to what's necessary
:hash: Revamped benchmark, now also covers Google's JS implementation
:hash: Updated dependencies and dist files

6.7.1

New

:hash: Made .verify behave more like .encode, see #710

CLI

:hash: With null/undefined eliminated by constructors and .create, document message fields as non-optional where applicable (ideally used with TS & strictNullChecks), see #743
:hash: Renamed --strict-long/message to --force-long/message with backward compatible aliases, see #741
:hash: Keep $Properties with --strict-message but require actual instances within, see #741
:hash: Added --strict-message option to pbjs to strictly reference message instances instead of $Properties, see #741

Docs

:hash: Restructured README
:hash: Added more information on typings usage, see #744
:hash: Clarified typescript example in README, see #744
:hash: Clarified that the service API targets clients consuming a service, see #742

Other

:hash: Omit copying of undefined or null in constructors and .create, see #743

6.7.0

Breaking

:hash: Namespace#lookupEnum should actually look up the reflected enum and not just its values
:hash: Decoder now throws if required fields are missing, see #695 / #696

Fixed

:hash: Added functionality to filter for multiple types at once in lookup(), used by lookupTypeOrEnum(), fixes #740
:hash: Ensure that fields have been resolved when looking up js types in static target, see #731
:hash: Properly copy fields array before sorting in toObject, fixes #729
:hash: Actually emit TS compatible enums in static target if not aliases, see #720
:hash: Hardened tokenize/parse, esp. comment parsing, see #713
:hash: Exclude any fields part of some oneof when populating defaults in toObject, see #710
:hash: Most of the parser is not case insensitive, see #705
:hash: Retain options argument in Root#load when used with promises, see #684

New

:hash: Created a micromodule from (currently still bundled) float support
:hash: util.isset(obj, prop) can be used to test if a message property is considered to be set, see #728
:hash: Implemented stubs for long.js / node buffers to be used where either one isn't wanted, see #718
:hash: Simplified reusing / replacing internal constructors
:hash: Constructors/.create always initialize proper mutable objects/arrays, see #700
:hash: Verifiers return an error if multiple fields part of the same oneof are set, see #710
:hash: Added oneofs: true to ConversionOptions, see #710
:hash: Optional fields handle null just like undefined regardless of type see #709
:hash: Encoders no longer examine virtual oneof properties but encode whatever is present, see #710
:hash: pbjs now generates multiple exports when using ES6 syntax, see #686
:hash: Sequentially serialize fields ordered by id, as of the spec.
:hash: decode throws specific ProtocolError with a reference to the so far decoded message if required fields are missing + example
:hash: Reader.create asserts that buffer is a valid buffer, see #695

CLI

:hash: Exclude JSDoc on typedefs from generated d.ts files because typescript@next, see #737
:hash: Prepare static code with estraverse instead of regular expressions, see #732
:hash: Moved tsd-jsdoc to future cli package, see #716
:hash: $Properties are just a type that's satisfied, not implemented, by classes, see #723
:hash: More progress on decoupling the CLI
:hash: Fixed computed array indexes not being renamed in static code, see #726
:hash: Check upfront if key-var is required in static decoders with maps, see #726
:hash: Fixed handling of stdout if callback is specified, see #724
:hash: Preparations for moving the CLI to its own package, see #716
:hash: Properly implement $Properties interface in JSDoc, see #723
:hash: Recursively use $Properties inside of $Properties in static code, see #717
:hash: Added --strict-long option to pbjs to always emit 'Long' instead of 'number|Long' (only relevant with long.js), see #718
:hash: Statically emitted long type is 'Long' now instead of '$protobuf.Long', see #718
:hash: Decoupled message properties as an interface in static code for TS intellisense support, see #717
:hash: Static code statically resolves types[..], see #715

Docs

:hash: Added type definitions for all possible JSON descriptors
:hash: Explained the JSON structure in README and moved CLI specific information to the CLI package
:hash: Added information on how to use the stubs to README, see #718
:hash: Added 'What is a valid message' section to README
:hash: Added a hint on using .create to initial example
:hash: Even more usage for README
:hash: Additional information on general usage (README)
:hash: Restructured README to Installation, Usage and Examples sections
:hash: Added a longish section on the correct use of the toolset to README
:hash: Added a few additional notes on core methods to README, see #710
:hash: Extended traverse-types example, see #693
:hash: Better explain how .verify, .encode and .decode are connected
:hash: Documented that Type#encode respectively Message.encode do not implicitly .verify, see #696 [ci-skip]
:hash: Documented throwing behavior of Reader.create and Message.decode
:hash: Added error handling notes to README, see #696

Other

:hash: Use @protobufjs/float
:hash: Rebuilt dist files for 6.7.0
:hash: Updated deps, ts fixes and regenerated dist files
:hash: Manually merged gentests improvements, fixes #733
:hash: Make sure that util.Long is overridden by AMD loaders only if present, see #730
:hash: Coverage for util.isset and service as a namespace
:hash: Shortened !== undefined && !== null to equivalent != null in static code
:hash: With stubs in place, 'number|Long' return values can be just 'Long' instead, see #718
:hash: Just alias as the actual ideal type when using stubs, see #718
:hash: General cleanup + regenerated dist/test files
:hash: Simplified camel case regex, see #714
:hash: Regenerated dist files and changelog for 6.7.0
:hash: Retain alias order in static code for what it's worth, see #712
:hash: Everything can be block- or line-style when parsing, see #713
:hash: Determine necessary aliases depending on config, see #712
:hash: Use more precise types for message-like plain objects
:hash: Regenerated dist files
:hash: Regenerated relevant files
:hash: Moved field comparer to util
:hash: Updated tests to use new simplified encoder logic
:hash: Updated path to tsd-jsdoc template used by pbts, see #707
:hash: Additional restructuring for moving configuration files out of the root folder
:hash: Added codegen support for constructor functions, see #700
:hash: Attempted to fix broken custom error test
:hash: Trying out a more aggressive aproach for custom error subclasses
:hash: Moved a few things out of the root folder
:hash: Coverage for encoder compat. / protocolerror
:hash: Updated dist and generated test files
:hash: Added tslint
:hash: Exclude dist/ from codeclimate checks
:hash: Also lint cli utilities
:hash: Cache any regexp instance (perf)
:hash: Use code climate badges
:hash: Updated travis to pipe to codeclimate, coverage
:hash: More precise linter configuration
:hash: Added codeclimate
:hash: Moved cli deps placeholder creation to post install script

6.6.5

Fixed

:hash: sfixed64 is not zig-zag encoded, see #692

CLI

:hash: Added a placeholder to cli deps node_modules folder to make sure node can load from it

Other

:hash: Restructured a few failing tests
:hash: Traversal example + minimalistic documentation
:hash: Added a custom getters/setters example for gRPC

6.6.4

Fixed

:hash: Made sure that LongBits ctor is always called with unsigned 32 bits + static codegen compat., fixes #690
:hash: Properly handle multiple ../.. in path.normalize, see #688
:hash: Post-merge, also tackles #683 (packed option for repeated enum values)

New

:hash: Verify accepts non-null objects only, see #685
:hash: allow_alias enum option was not being honored. This case is now handled and a test case was added

CLI

:hash: Added an experimental --sparse option to limit pbjs output to actually referenced types within main files

Docs

:hash: Added explicit hint on Uint8Array to initial example, see #670

Other

:hash: Ranges and names support for reserved fields, see #676
:hash: Updated depdendencies / rebuilt dist files
:hash: Use ?: instead of |undefined in .d.ts files
:hash: Mark optional fields as possibly being undefined
:hash: Added a few more common google types from google/api, see #433
:hash: Minor optimizations to dependencies, build process and tsd

6.6.3

Fixed

:hash: Support node 4.2.0 to 4.4.7 buffers + travis case, see #665

CLI

:hash: Added ES6 syntax flag to pbjs, see #667

Docs

:hash: Reference Buffer for BufferReader/Writer, see #668
:hash: Slightly shortened README
:hash: Additional notes on the distinction of different use cases / distributions, see #666
:hash: Extended README with additional information on JSON format
:hash: Added extended usage instructions for TypeScript and custom classes to README, see #666

Other

:hash: Updated dist files
:hash: Updated test cases to use new buffer util
:hash: Added fetch test cases + some test cleanup

6.6.2

Fixed

:hash: Properly replace short vars when beautifying static code, see #663
:hash: Use custom prelude in order to exclude any module loader code from source (for webpack), see #658
:hash: Make sure to check optional inner messages for null when encoding, see #658

New

:hash: Initial attempt on a backwards compatible fetch implementation with binary support, see #661

Other

:hash: Root#resolvePath skips files when returning null, see #368
:hash: Changes callback on failed response decode in rpc service to pass actual error instead of 'error' string
:hash: Travis should exit with the respective error when running sauce tests
:hash: Moved checks whether a test case is applicable to parent case
:hash: Added eventemitter tests and updated micromodule dependencies (so far)
:hash: Added lib/path tests and updated a few dependencies
:hash: Moved micro modules to lib so they can have their own tests etc.
:hash: Updated travis

6.6.1

Fixed

:hash: Properly set up reflection when using light build

6.6.0 (release)

Breaking

:hash: Inlined / refactored away .testJSON, see #653
:hash: Refactored util.extend away
:hash: Reflected and statically generated services use common utility, now work exactly the same
:hash: fromObject now throws for entirely bogus values (repeated, map and inner message fields), fixes #601
:hash: Cleaned up library distributions, now is full / light / minimal with proper browserify support for each

Fixed

:hash: Do not randomly remove slashes from comments, fixes #656
:hash: Properly parse nested textformat options, also tackles #655

New

:hash: Relieved the requirement to call .resolveAll() on roots in order to populate static code-compatible properties, see #653
:hash: Added a (highly experimental) debug build as a starting point for #653
:hash: Full build depends on light build depends on minimal build, shares all relevant code

CLI

:hash: Also reuse specified root in pbjs for JSON modules, see #653
:hash: Reuse specified root name in pbjs to be able to split definitions over multiple files more easily, see #653

Docs

:hash: Improved pbjs/pbts examples, better covers reflection with definitions for static modules
:hash: Fixed centered formatting on npm

Other

:hash: Various other minor improvements / assertions refactored away, see #653
:hash: Fixed some common reflection deopt sites, see #653
:hash: Reflection performance pass, see #653
:hash: Added TS definitions to alternative builds' index files
:hash: Removed unnecessary prototype aliases, improves gzip ratio
:hash: Unified behaviour of and docs on Class constructor / Class.create
:hash: Statically generated services actually inherit from rpc.Service
:hash: Do not try to run sauce tests for PRs
:hash: Added utility to enable/disable debugging extensions to experimental debug build
:hash: Fixed node 0.12 tests
:hash: Fixed coverage
:hash: Added a test case for #652

6.5.3

Other

:hash: In fromObject, check if object is already a runtime message, see #652

6.5.2

Docs

:hash: Added coverage reporting

CLI

:hash: Added version scheme warning to everything CLI so that we don't need this overly explicit in README

Other

:hash: Coverage progress, 100%
:hash: Coverage progress
:hash: Attempted to fix badges once and for all
:hash: Coverage progress

6.5.1

CLI

:hash: Reuse module paths when looking up cli dependencies, see #648
:hash: Check actual module directories to determine if cli dependencies are present and bootstrap semver, see #648

Docs

:hash: Added a note on semver-incompatibility, see #649

Other

:hash: Coverage progress

6.5.0 (release)

Breaking

:hash: Initial upgrade of converters to real generated functions, see #620

Fixed

:hash: An enum's default value present as a string looks up using typeDefault, not defaultValue which is an array if repeated
:hash: Use common utility for virtual oneof getters and setters in both reflection and static code, see #644
:hash: Properly use Type.toObject/Message.toObject within converters, see #641
:hash: Generate null/undefined assertion in fromObject if actually NOT an enum, see #620
:hash: Replace ALL occurencies of types[%d].values in static code, see #641

New

:hash: Switched to own property-aware encoders for compatibility, see #639
:hash: Now also parses comments, sets them on reflected objects and re-uses them when generating static code, see #640

CLI

:hash: Further improved generated static code style
:hash: Removed scoping iifes from generated static code
:hash: Removed even more clutter from generated static code
:hash: Removed various clutter from generated static code
:hash: Made sure that static target's replacement regexes don't match fields
:hash: Also accept (trailing) triple-slash comments for compatibility with protoc-gen-doc, see #640
:hash: Use semver to validate that CLI dependencies actually satisfy the required version, see #637

Docs

:hash: Added a hint on documenting .proto files for static code
:hash: Documented internally used codegen partials for what it's worth
:hash: Updated converter documentation

Other

:hash: Bundler provides useful stuff to uglify and a global var without extra bloat
:hash: Cleaned and categorized tests, coverage progress
:hash: Properly removed builtins from bundle
:hash: Call hasOwnProperty builtin as late as possible decreasing the probability of having to call it at all (perf)
:hash: Slightly hardened codegen sprintf
:hash: Significantly improved uint32 write performance
:hash: Cleaned up test case data and removed unused files
:hash: Removed now useless trailing comment checks, see #640
:hash: Ensured that pbjs' beautify does not break regular expressions in generated verify functions

6.4.6

Fixed

:hash: Case-sensitively test for legacy group definitions, fixes #638
:hash: Properly parse text format options + simple test case, fixes #636

Docs

:hash: Added SVG logo, see #629

Other

:hash: Also refactored Service and Type to inherit from NamespaceBase, see #635
:hash: Moved TS-compatible Namespace features to a virtual NamespaceBase class, compiles with strictNullChecks by default now, see #635
:hash: Minor codegen enhancements

6.4.5

Fixed

:hash: Properly handle empty/noop Writer#ldelim, fixes #625
:hash: Properly annotate map fields in pbjs, fixes #624

New

:hash: Made sure that Writer#bytes is always able to handle plain arrays

Other

:hash: Slightly restructured utility to better support static code default values

6.4.4

Fixed

:hash: Dynamically resolve jsdoc when running pbts, fixes #622

Docs

:hash: Explain 6.4.2 vs 6.4.3 in changelog

6.4.3

Fixed

:hash: Fixed invalid definition of Field#packed property, also introduced decoder.compat mode (packed fields, on by default)
:hash: Always decode packed/non-packed based on wire format only, see #602
:hash: Use full library for JSON modules and runtime dependency for static modules, fixes #621

CLI

:hash: Additional workarounds for on demand CLI dependencies, see #618
:hash: Revised automatic setup of cli dependencies, see #618

Other

:hash: Removed Android 4.0 test (no longer supported by sauce)
:hash: Removed some unused utility, slightly more efficient codegen, additional comments
:hash: Updated tests for new package.json layout
:hash: Added break/continue label support to codegen
:hash: Updated dependencies, rebuilt dist files and changed logo to use an absolute url

6.4.2 had been accidentally published as 6.4.3.

6.4.1

Fixed

:hash: Added more default value checks to converter, fixes #616
:hash: Respect long defaults in converters
:hash: Convert inner messages and undefined/null values more thoroughly, fixes #615
:hash: Always use first defined enum value as field default, fixes #613
:hash: Install correct 'tmp' dependency when running pbts without dev dependencies installed, fixes #612

New

:hash: Generate named constructors for runtime messages, see #588

CLI

:hash: pbjs/pbts no longer generate any volatile headers, see #614

Docs

:hash: Attempted to make broken shields less annoying
:hash: Updated README

Other

:hash: Some cleanup and added a logo
:hash: use $protobuf.Long

6.4.0 (release)

Breaking

:hash: Dropped IE8 support
:hash: Removed now unused util.longNeq which was used by early static code

Fixed

:hash: Do not swallow errors in loadSync, also accept negative enum values in Enum#add, fixes #609
:hash: Improved bytes field support, also fixes #606
:hash: Fall back to browser Reader when passing an Uint8Array under node, fixes #605
:hash: Respect optional properties when writing interfaces in tsd-jsdoc, fixes #598

New

:hash: Instead of protobuf.parse.keepCase, fall back to protobuf.parse.defaults holding all possible defaults, see #608
:hash: Added global ParseOptions#keepCase fallback as protobuf.parse.keepCase, see #608
:hash: Converters use code generation and support custom implementations
:hash: Be more verbose when throwing invalid wire type errors, see #602
:hash: Added an asJSON-option to always populate array fields, even if defaults=false, see #597
:hash: Attempt to improve TypeScript support by using explicit exports
:hash: Copy-pasted typescript definitions to micro modules, see #599
:hash: Emit an error on resolveAll() if any extension fields cannot be resolved, see #595 + test case

CLI

:hash: Removed 'not recommend' label for --keep-case, see #608
:hash: Added customizable linter configuration to pbjs
:hash: Added stdin support to pbjs and pbts
:hash: Static code no longer uses IE8 support utility
:hash: Generated static code now supports asJSON/from
:hash: Added support for TypeScript enums to pbts
:hash: Added a few helpful comments to static code
:hash: Slightly beautify statically generated code
:hash: Do not wrap main definition as a module and export directly instead
:hash: Generate prettier definitions with --no-comments
:hash: Added variable arguments support to tsd-jsdoc
:hash: Reference dependency imports as a module to prevent name collisions, see #596
:hash: Removed now unnecessary comment lines in generated static code

Docs

:hash: Added notes on CSP-restricted environments to README, see #593

Other

:hash: Added test case for asJSON with arrays=true, see #597
:hash: Added a tape adapter to assert message equality accross browsers
:hash: Refactored some internal utility away
:hash: Reverted previous attempt on #597
:hash: Minor tsd-jsdoc refactor
:hash: Removed unused sandbox files
:hash: Updated package.json of micro modules to reference types, see #599
:hash: Reference dependencies as imports in generated typescript definitions, see #596
:hash: Allow null values on optional long fields, see #590
:hash: Various jsdoc improvements and a workaround for d.ts generation, see #592

6.3.1

Fixed

:hash: Empty inner messages are always present on the wire + test case + removed now unused Writer#ldelim parameter, see #585

CLI

:hash: Expose tsd-jsdoc's comments option to pbts as --no-comments, see #587
:hash: Increase child process max buffer when running jsdoc from pbts, see #587
:hash: pbjs now generates more convenient dot-notation property accessors

Other

:hash: And fixed IE8 again (should probably just drop IE8 for good)

6.3.0

Breaking

:hash: Moved camelCase/underScore away from util to where actually used
:hash: Renamed asJSON option keys (enum to enums, long to longs) because enum is a reserved keyword
:hash: Moved JSON/Message conversion to its own source file and added Message/Type.from + test case, see #575
:hash: Relicensed the library and its components to BSD-3-Clause to match the official implementation (again)
:hash: Dropped support for browser buffer entirely (is an Uint8Array anyway), ensures performance and makes things simpler
:hash: Removed dead parts of the Reader API
:hash: Refactored BufferReader/Writer to their own files and removed unnecessary operations (node always has FloatXXArray and browser buffer uses ieee anyway)
:hash: Stripped out fallback encoder/decoder/verifier completely (even IE8 supports codegen), significantly reduces bundle size, can use static codegen elsewhere

Fixed

:hash: Actually concatenate mixed custom options when parsing
:hash: Fixed a couple of issues with alternative browser builds
:hash: Properly set long defaults on prototypes
:hash: Fixed reference error in minimal runtime, see #580
:hash: Non-repeated empty messages are always present on the wire, see #581
:hash: Properly check Buffer.prototype.set with node v4
:hash: Prevent NRE and properly annotate verify signature in tsd-jsdoc, fixed #572
:hash: Fix directly using Buffer instead of util.Buffer
:hash: Added filter type to Namespace#lookup, fixes #569
:hash: Fixed parsing enum inner options, see #565
:hash: Fixed release links in README files

New

:hash: Added a noparse build for completeness
:hash: Now compresses .gz files using zopfli to make them useful beyond being just a reference
:hash: Updated non-bundled google types folder with missing descriptors and added wrappers to core
:hash: Replaced the ieee754 implementation for old browsers with a faster, use-case specific one + simple test case
:hash: Added .create to statically generated types and uppercase nested elements to reflection namespaces, see #576
:hash: Also added Namespace#getEnum for completeness, see #576
:hash: Added Namespace#getEnum and changed #lookupEnum to the same behavior, see #576
:hash: Added a heap of coverage comments for usually unused code paths to open things up
:hash: Added codegen test to determine if any ancient browsers don't actually support it
:hash: Added legacy groups support to pbjs, see #568
:hash: Initial support for legacy groups + test case, see #568
:hash: Added asJSON bytes as Buffer, see #566

CLI

:hash: Annotated callback types in pbjs-generated services, see #582
:hash: Removed type/ns alias comment in static target to not confuse jsdoc unnecessarily
:hash: Made pbjs use loadSync for deterministic outputs, see #573

Docs

:hash: Updated documentation on runtime and noparse builds
:hash: Fixed an issue with the changelog generator skipping some commits
:hash: Added notes on how to use pbjs and pbts programmatically
:hash: Manually sorted old changelog entries
:hash: Initial changelog generator, see #574
:hash: Added static/JSON module interchangeability to README
:hash: Updated README and bundler according to dynamic require calls

Other

:hash: Added basic services test case
:hash: Just polyfill Buffer.from / .allocUnsafe for good
:hash: Added a test case to find out if all the fallbacks are just for IE8
:hash: Commented out float assertions in float test including explanation
:hash: Expose array implementation used with (older) browsers on util for tests
:hash: Updated test cases
:hash: Added assumptions to float test case
:hash: Updated travis config to use C++11
:hash: Updated / added additional LICENSE files where appropriate
:hash: Integrated changelog into build process, now also has 'npm run make' for everything, see #574
:hash: Minor optimizations through providing type-hints
:hash: Reverted shortened switch statements in verifier
:hash: Enums can't be map key types
:hash: Use custom require (now a micromodule) for all optional modules, see #571
:hash: Support usage when size = 0
:hash: Reverted aliases frequently used in codegen for better gzip ratio
:hash: Shrinked bundle size - a bit
:hash: Can finally run with --trace-deopt again without crashes
:hash: Other minor optimizations

6.2.1

New

:hash: Added ParseOptions to protobuf.parse and --keep-case for .proto sources to pbjs, see #564

Other

:hash: Better TypeScript definition support for @property-annotated objects
:hash: Can't just inline longNeq but can be simplified
:hash: Array abuse and varint optimization
:hash: Updated dependencies
:hash: Other minor improvements to short ifs
:hash: Reader/Writer example

6.2.0

Fixed

:hash: Fixed reserved names re, also ensure valid service method names, see #559
:hash: Fix d.ts whitespace on empty lines, added tsd-jsdoc LICENSE
:hash: Fix asJSON defaults option, make it work for repeated fields.
:hash: Inlined any Reader/Writer#tag calls, also fixes #556
:hash: Fix building default dist files with explicit runtime=false
:hash: Apply asJSON recursively
:hash: Ensure working reflection class names with minified builds
:hash: Lazily resolve (some) cyclic dependencies, see #560

New

:hash: Added protobuf.roots to minimal runtime, see #554
:hash: Repo now includes a restructured version of tsd-jsdoc with our changes incorporated for issues/prs, see #550

CLI

:hash: Updated pbjs arguments
:hash: Pipe tsd-jsdoc output (requires dcodeIO/tsd-jsdoc/master) and respect cwd, see #550
:hash: tsd-jsdoc progress

Docs

:hash: README

Other

:hash: Added GH issue template
:hash: Path micromodule, dependencies
:hash: Test case for #556
:hash: Raw alloc benchmark
:hash: Other minor optimizations

6.1.1

Fixed

:hash: Properly encode/decode map kv pairs as repeated messages (codegen and fallback), see #547
:hash: Make genVerifyKey actually generate conditions for 32bit values and bool, fixes #546
:hash: Fix to generation of verify methods for bytes
:hash: Take special care of oneofs when encoding (i.e. when explicitly set to defaults), see #542

New

:hash: Added Message#asJSON option for bytes conversion
:hash: Added Namespace#lookupType and Namespace#lookupService (throw instead of returning null), see #544
:hash: Provide prebuilt browser versions of the static runtime

CLI

:hash: Initial pbts CLI for generating TypeScript definitions, see #550
:hash: Refactored json/static-module targets to use common wrappers
:hash: Refactor cli to support multiple built-in wrappers, added named roots instead of always using global.root and added additionally necessary eslint comments, see #540
:hash: Annotate namespaces generated by static target, see #550
:hash: static target: Basic support for oneof fields, see #542

Docs

:hash: Fix to reflection documentation
:hash: README on minimal runtime / available downloads
:hash: Notes on descriptors vs static modules

Other

:hash: A lot of minor optimizations to performance and gzip ratio
:hash: Minimized base64 tables

6.1.0

Breaking

:hash: Removed as-function overload for Reader/Writer, profiler stub, optimized version of Reader#int32
:hash: Refactored Prototype and inherits away, is now Class and Message for more intuitive documentation and type refs

Fixed

:hash: Fixed failing test case on node < 6
:hash: Fixed serialization order of sfixed64, fixes #536
:hash: Fixed serialization order of fixed64, fallback to parseInt with no long lib, see #534
:hash: Actually allow undefined as service method type, fixes #528
:hash: Do not skip optional delimiter after aggregate options, fixes #520
:hash: Verify empty base64 encoded strings for bytes fields, see #535
:hash: wrong spell role should be rule
:hash: decodeDelimited always forks if writer is specified, see #531
:hash: Mimic spec-compliant behaviour in oneof getVirtual, see #523

New

:hash: Initial base64 string support for bytes fields, see #535
:hash: Initial type-checking verifier, see #526, added to bench out of competition
:hash: Initial loadSync (node only), see #529
:hash: Initial RPC service implementaion, see #529
:hash: added 'defaults' option to Prototype#asJSON, see #521
:hash: Use Uint8Array pool in browsers, just like node does with buffers
:hash: Also validate map fields, see #526 (this really needs some tests)

CLI

:hash: Added json-module target to pbjs, renamed static to static-module, see #522
:hash: updated internals and static target to use immutable objects on prototypes

Docs

:hash: Added a couple of alternative signatures, protobuf.load returns promise or undefined, aliased Reader/Writer-as-function signature with Reader/Writer.create for typed dialects, see #518
:hash: Added variations for Root#load, see #527
:hash: Added benchmark and profile related information to README
:hash: Added service example to README, see #529
:hash: README on tests
:hash: Update README/dist to reflect recent changes
:hash: Minimal documentation for micromodules
:hash: Document all the callbacks, see #527
:hash: Documented streaming-rpc example a bit

Other

:hash: Removed the need for triple-slash references in .d.ts by providing a minimal Long interface, see #527, see #530
:hash: Transition to micromodules
:hash: Refactored argument order of utf8 for plausibility
:hash: Restructured reusable micromodules
:hash: Can't use Uint8Array#set on node < 6 buffers
:hash: Test case for #531
:hash: Safer signaling for synchronous load, see #529
:hash: Proper end of stream signaling to rpcImpl, see #529
:hash: Moved event emitter to util, also accepts listener context, see #529
:hash: Probably the worst form of hiding require programmatically, see #527
:hash: Attempt to hide require('fs') from webpack, see #527
:hash: Trying out jsdoc variations, see #527
:hash: by the way, why not include the json->proto functionality into "util"?
:hash: Update proto.js
:hash: Automatic profile generation and processing
:hash: Generalized buffer pool and moved it to util
:hash: Make shields visible on npm, yey
:hash: More shields, I love shields, and maybe a workaround for travis timing out when sauce takes forever
:hash: Trying SauceLabs with higher concurrency

6.0.2

Fixed

:hash: Fix packable float/double see #513

New

:hash: Handle oneofs in prototype ctor, add non-ES5 fallbacks, test case
:hash: Be nice to AMD, allow reconfiguration of Reader/Writer interface

CLI

:hash: Initial static codegen target for reference
:hash: pbjs static target services support
:hash: pbjs static target progress, uses customizable wrapper template
:hash: Static pbjs target progress, now generates usable CommonJS code, see #512

Docs

:hash: TypeScript example
:hash: Adjectives, notes on browserify

Other

:hash: Refactor runtime util into separate file, reader/writer uses runtime util
:hash: Also optimize reader with what we have learned
:hash: More (shameless) writer over-optimization
:hash: Trading package size for float speed
:hash: Skip defining getters and setters on IE8 entirely, automate defining fallbacks
:hash: Unified proto/reflection/classes/static encoding API to always return a writer
:hash: plain js utf8 is faster for short strings
:hash: improve TypeScript support. add simple test script.
:hash: Use long.js dependency in tests, reference types instead of paths in .d.ts see #503
:hash: Restructured encoder / decoder to better support static code gen

6.0.1

Fixed

:hash: Add support for long strings, fixes #509
:hash: expose zero on LongBits, fixes #508
:hash: Fixed issues with Root.fromJSON/#addJSON, search global for Long
:hash: Properly exclude browserify's annoying _process, again, fixes #502
:hash: Remember loaded files earlier to prevent race conditions, fixes #501
:hash: Allow negative enum ids even if super inefficient (encodes as 10 bytes), fixes #499, fixes #500
:hash: set resolvedResponseType on resolve(), fixes #497

New

:hash: Initial take on runtime services, see #507
:hash: Include dist/ in npm package for frontend use

CLI

:hash: pbjs proto target field options, language-level compliance with jspb test.proto

Docs

:hash: always use Uint8Array in docs for tsd, see #503
:hash: Notes on dist files

Other

:hash: Update eslint env
:hash: Browser field in package.json isn't required