Protobuf Es Versions Save

Protocol Buffers for ECMAScript. The only JavaScript Protobuf library that is fully-compliant with Protobuf conformance tests.

v1.9.0

4 weeks ago

What's Changed

New Contributors

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.8.0...v1.9.0

v2.0.0-alpha.1

4 weeks ago

What's new in version 2

To support Protobuf editions, we have to make breaking changes that also affect users of proto2 and proto3. This prompted us to make more extensive changes that take feedback from version 1 into account:

We no longer uses classes. Instead, we generate a type and a descriptor for every message, and provide functions to create a new instance, for serialization, and other concerns. Here is a simple example:

import { create, toBinary, fromBinary, fromJsonString } from "@bufbuild/protobuf";
import { UserDesc } from "./gen/user_pb.js";

let user = create(UserDesc, {
  firstName: "Homer",
  lastName: "Simpson",
  active: true,
  locations: ["Springfield"],
  projects: { SPP: "Springfield Power Plant" },
  manager: {
    firstName: "Montgomery",
    lastName: "Burns",
  },
});

const bytes = toBinary(UserDesc, user);
user = fromBinary(UserDesc, bytes);
user = fromJsonString(UserDesc, '{"firstName": "Homer", "lastName": "Simpson"}');

This approach solves several outstanding issues, such as:

If you use proto3, messages are now plain objects. Files with proto2 and editions use the prototype chain to track field presence.

Please note that this is an alpha release, and APIs might still change. We're also missing documentation yet. But if you want to try it out, we welcome your feedback!

This release is published with the alpha tag. To install the alpha packages, you can run:

npm install @bufbuild/protobuf@alpha @bufbuild/protoc-gen-es@alpha

Contributors

Thanks to @srikrsna-buf for his contributions to v2!

v1.8.0

2 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.7.2...v1.8.0

v1.7.2

3 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.7.1...v1.7.2

v1.7.1

3 months ago

What's Changed

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.7.0...v1.7.1

v1.7.0

3 months ago

What's Changed

This release adds support for extensions, a Protobuf language feature that allows to extend a message with an additional field.

For example:

syntax = "proto2";

message User {
  extensions 100 to 200;
}

extend User {
  optional uint32 age = 100;
}

For the extension age, we generate a new export const age: Extension<User, number>. You can set the extension field with the function setExtension:

import { setExtension } from "@bufbuild/protobuf";
import { User, age } from "./example_pb.js";

const user = new User();
setExtension(user, age, 77);

To learn more about the details, see the API documentation.

For plugin authors: Since extensions provide a better way to access custom options in a plugin, we are deprecating the findCustom*Option functions from @bufbuild/protoplugin/ecmascript. We recommend to switch to extensions for better type safety and flexibility, see the PR for details.

All changes

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.6.0...v1.7.0

v1.6.0

5 months ago

What's Changed

  • Add CommonJS support as a plugin option by @timostamm in #648
  • Add GeneratedFile.jsDoc() and other features to @bufbuild/protoplugin by @timostamm in #649

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.5.1...v1.6.0

v1.5.1

5 months ago

What's Changed

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.5.0...v1.5.1

v1.5.0

5 months ago

This release includes preliminary support for editions. Please note that it's still an experimental feature.

What's Changed

New Contributors

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.4.2...v1.5.0

v1.4.2

6 months ago

What's Changed

Full Changelog: https://github.com/bufbuild/protobuf-es/compare/v1.4.1...v1.4.2