Skip to content

Commit bbe93a2

Browse files
deps: bump @bufbuild/protobuf from 1.10.0 to 2.0.0 (#139)
* deps: bump @bufbuild/protobuf from 1.10.0 to 2.0.0 Bumps [@bufbuild/protobuf](https://github.com/bufbuild/protobuf-es/tree/HEAD/packages/protobuf) from 1.10.0 to 2.0.0. - [Release notes](https://github.com/bufbuild/protobuf-es/releases) - [Commits](https://github.com/bufbuild/protobuf-es/commits/v2.0.0/packages/protobuf) --- updated-dependencies: - dependency-name: "@bufbuild/protobuf" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * chore: update protobuf-es code --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Potsides <[email protected]>
1 parent b7de3e4 commit bbe93a2

File tree

3 files changed

+80
-177
lines changed

3 files changed

+80
-177
lines changed

packages/protons-benchmark/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"start:browser": "npx playwright-test dist/src/implementations/index.js --runner benchmark"
4949
},
5050
"dependencies": {
51-
"@bufbuild/protobuf": "^1.0.0",
51+
"@bufbuild/protobuf": "^2.0.0",
5252
"@bufbuild/protoc-gen-es": "^2.0.0",
5353
"@protobuf-ts/plugin": "^2.8.1",
5454
"@protobuf-ts/runtime": "^2.8.1",

packages/protons-benchmark/src/implementations/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ $ node dist/src/index.js
55
$ npx playwright-test dist/src/index.js --runner benchmark
66
*/
77

8+
import { create, toBinary, fromBinary } from '@bufbuild/protobuf'
89
import { expect } from 'aegir/chai'
910
import Benchmark from 'benchmark'
1011
import { encodeTest as pbjsEncodeTest, decodeTest as pbjsDecodeTest } from './pbjs/bench.js'
11-
import { Test as ProtobufEsTest } from './protobuf-es/bench_pb.js'
12+
import { TestSchema as ProtobufEsTest } from './protobuf-es/bench_pb.js'
1213
import { Test as ProtobufTsTest } from './protobuf-ts/bench.js'
1314
import { Test as ProtobufjsTest } from './protobufjs/bench.js'
1415
import { Test as ProtonsTest } from './protons/bench.js'
@@ -61,8 +62,8 @@ new Benchmark.Suite()
6162
expectDecodedCorrectly(result)
6263
})
6364
.add('protobuf-es', () => {
64-
const buf = new ProtobufEsTest(message).toBinary()
65-
const result = ProtobufEsTest.fromBinary(buf)
65+
const buf = toBinary(ProtobufEsTest, create(ProtobufEsTest, message))
66+
const result = fromBinary(ProtobufEsTest, buf)
6667

6768
expectDecodedCorrectly(result)
6869
})
Original file line numberDiff line numberDiff line change
@@ -1,152 +1,72 @@
1-
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
2-
// @generated from file bench.proto (syntax proto3)
1+
// @generated by protoc-gen-es v2.0.0 with parameter "target=ts"
2+
// @generated from file packages/protons-benchmark/src/implementations/bench.proto (syntax proto3)
33
/* eslint-disable */
4-
// @ts-nocheck
54

6-
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
7-
import { Message, proto3 } from "@bufbuild/protobuf";
5+
import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
6+
import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
7+
import type { Message } from "@bufbuild/protobuf";
88

99
/**
10-
* @generated from enum FOO
10+
* Describes the file packages/protons-benchmark/src/implementations/bench.proto.
1111
*/
12-
export enum FOO {
13-
/**
14-
* @generated from enum value: NONE = 0;
15-
*/
16-
NONE = 0,
17-
18-
/**
19-
* @generated from enum value: LOL = 1;
20-
*/
21-
LOL = 1,
22-
23-
/**
24-
* @generated from enum value: ABE = 3;
25-
*/
26-
ABE = 3,
27-
}
28-
// Retrieve enum metadata with: proto3.getEnumType(FOO)
29-
proto3.util.setEnumType(FOO, "FOO", [
30-
{ no: 0, name: "NONE" },
31-
{ no: 1, name: "LOL" },
32-
{ no: 3, name: "ABE" },
33-
]);
12+
export const file_packages_protons_benchmark_src_implementations_bench: GenFile = /*@__PURE__*/
13+
fileDesc("CjpwYWNrYWdlcy9wcm90b25zLWJlbmNobWFyay9zcmMvaW1wbGVtZW50YXRpb25zL2JlbmNoLnByb3RvIh8KA0ZvbxIQCgNiYXoYASABKA1IAIgBAUIGCgRfYmF6IiUKA0JhchIWCgN0bXAYASABKAsyBC5Gb29IAIgBAUIGCgRfdG1wIhcKAllvEhEKA2xvbBgBIAMoDjIELkZPTyIwCgNMb2wSEAoDbG9sGAEgASgJSACIAQESDwoBYhgCIAEoCzIELkJhckIGCgRfbG9sIoABCgRUZXN0EhYKA21laBgGIAEoCzIELkxvbEgAiAEBEhIKBWhlbGxvGAMgASgNSAGIAQESEAoDZm9vGAEgASgJSAKIAQESFAoHcGF5bG9hZBgHIAEoDEgDiAEBQgYKBF9tZWhCCAoGX2hlbGxvQgYKBF9mb29CCgoIX3BheWxvYWQqIQoDRk9PEggKBE5PTkUQABIHCgNMT0wQARIHCgNBQkUQA2IGcHJvdG8z");
3414

3515
/**
3616
* @generated from message Foo
3717
*/
38-
export class Foo extends Message<Foo> {
18+
export type Foo = Message<"Foo"> & {
3919
/**
4020
* @generated from field: optional uint32 baz = 1;
4121
*/
4222
baz?: number;
23+
};
4324

44-
constructor(data?: PartialMessage<Foo>) {
45-
super();
46-
proto3.util.initPartial(data, this);
47-
}
48-
49-
static readonly runtime = proto3;
50-
static readonly typeName = "Foo";
51-
static readonly fields: FieldList = proto3.util.newFieldList(() => [
52-
{ no: 1, name: "baz", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
53-
]);
54-
55-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Foo {
56-
return new Foo().fromBinary(bytes, options);
57-
}
58-
59-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Foo {
60-
return new Foo().fromJson(jsonValue, options);
61-
}
62-
63-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Foo {
64-
return new Foo().fromJsonString(jsonString, options);
65-
}
66-
67-
static equals(a: Foo | PlainMessage<Foo> | undefined, b: Foo | PlainMessage<Foo> | undefined): boolean {
68-
return proto3.util.equals(Foo, a, b);
69-
}
70-
}
25+
/**
26+
* Describes the message Foo.
27+
* Use `create(FooSchema)` to create a new message.
28+
*/
29+
export const FooSchema: GenMessage<Foo> = /*@__PURE__*/
30+
messageDesc(file_packages_protons_benchmark_src_implementations_bench, 0);
7131

7232
/**
7333
* @generated from message Bar
7434
*/
75-
export class Bar extends Message<Bar> {
35+
export type Bar = Message<"Bar"> & {
7636
/**
7737
* @generated from field: optional Foo tmp = 1;
7838
*/
7939
tmp?: Foo;
40+
};
8041

81-
constructor(data?: PartialMessage<Bar>) {
82-
super();
83-
proto3.util.initPartial(data, this);
84-
}
85-
86-
static readonly runtime = proto3;
87-
static readonly typeName = "Bar";
88-
static readonly fields: FieldList = proto3.util.newFieldList(() => [
89-
{ no: 1, name: "tmp", kind: "message", T: Foo, opt: true },
90-
]);
91-
92-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Bar {
93-
return new Bar().fromBinary(bytes, options);
94-
}
95-
96-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Bar {
97-
return new Bar().fromJson(jsonValue, options);
98-
}
99-
100-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Bar {
101-
return new Bar().fromJsonString(jsonString, options);
102-
}
103-
104-
static equals(a: Bar | PlainMessage<Bar> | undefined, b: Bar | PlainMessage<Bar> | undefined): boolean {
105-
return proto3.util.equals(Bar, a, b);
106-
}
107-
}
42+
/**
43+
* Describes the message Bar.
44+
* Use `create(BarSchema)` to create a new message.
45+
*/
46+
export const BarSchema: GenMessage<Bar> = /*@__PURE__*/
47+
messageDesc(file_packages_protons_benchmark_src_implementations_bench, 1);
10848

10949
/**
11050
* @generated from message Yo
11151
*/
112-
export class Yo extends Message<Yo> {
52+
export type Yo = Message<"Yo"> & {
11353
/**
11454
* @generated from field: repeated FOO lol = 1;
11555
*/
116-
lol: FOO[] = [];
117-
118-
constructor(data?: PartialMessage<Yo>) {
119-
super();
120-
proto3.util.initPartial(data, this);
121-
}
122-
123-
static readonly runtime = proto3;
124-
static readonly typeName = "Yo";
125-
static readonly fields: FieldList = proto3.util.newFieldList(() => [
126-
{ no: 1, name: "lol", kind: "enum", T: proto3.getEnumType(FOO), repeated: true },
127-
]);
128-
129-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Yo {
130-
return new Yo().fromBinary(bytes, options);
131-
}
132-
133-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Yo {
134-
return new Yo().fromJson(jsonValue, options);
135-
}
136-
137-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Yo {
138-
return new Yo().fromJsonString(jsonString, options);
139-
}
140-
141-
static equals(a: Yo | PlainMessage<Yo> | undefined, b: Yo | PlainMessage<Yo> | undefined): boolean {
142-
return proto3.util.equals(Yo, a, b);
143-
}
144-
}
56+
lol: FOO[];
57+
};
58+
59+
/**
60+
* Describes the message Yo.
61+
* Use `create(YoSchema)` to create a new message.
62+
*/
63+
export const YoSchema: GenMessage<Yo> = /*@__PURE__*/
64+
messageDesc(file_packages_protons_benchmark_src_implementations_bench, 2);
14565

14666
/**
14767
* @generated from message Lol
14868
*/
149-
export class Lol extends Message<Lol> {
69+
export type Lol = Message<"Lol"> & {
15070
/**
15171
* @generated from field: optional string lol = 1;
15272
*/
@@ -156,40 +76,19 @@ export class Lol extends Message<Lol> {
15676
* @generated from field: Bar b = 2;
15777
*/
15878
b?: Bar;
79+
};
15980

160-
constructor(data?: PartialMessage<Lol>) {
161-
super();
162-
proto3.util.initPartial(data, this);
163-
}
164-
165-
static readonly runtime = proto3;
166-
static readonly typeName = "Lol";
167-
static readonly fields: FieldList = proto3.util.newFieldList(() => [
168-
{ no: 1, name: "lol", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
169-
{ no: 2, name: "b", kind: "message", T: Bar },
170-
]);
171-
172-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Lol {
173-
return new Lol().fromBinary(bytes, options);
174-
}
175-
176-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Lol {
177-
return new Lol().fromJson(jsonValue, options);
178-
}
179-
180-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Lol {
181-
return new Lol().fromJsonString(jsonString, options);
182-
}
183-
184-
static equals(a: Lol | PlainMessage<Lol> | undefined, b: Lol | PlainMessage<Lol> | undefined): boolean {
185-
return proto3.util.equals(Lol, a, b);
186-
}
187-
}
81+
/**
82+
* Describes the message Lol.
83+
* Use `create(LolSchema)` to create a new message.
84+
*/
85+
export const LolSchema: GenMessage<Lol> = /*@__PURE__*/
86+
messageDesc(file_packages_protons_benchmark_src_implementations_bench, 3);
18887

18988
/**
19089
* @generated from message Test
19190
*/
192-
export class Test extends Message<Test> {
91+
export type Test = Message<"Test"> & {
19392
/**
19493
* @generated from field: optional Lol meh = 6;
19594
*/
@@ -209,35 +108,38 @@ export class Test extends Message<Test> {
209108
* @generated from field: optional bytes payload = 7;
210109
*/
211110
payload?: Uint8Array;
111+
};
112+
113+
/**
114+
* Describes the message Test.
115+
* Use `create(TestSchema)` to create a new message.
116+
*/
117+
export const TestSchema: GenMessage<Test> = /*@__PURE__*/
118+
messageDesc(file_packages_protons_benchmark_src_implementations_bench, 4);
119+
120+
/**
121+
* @generated from enum FOO
122+
*/
123+
export enum FOO {
124+
/**
125+
* @generated from enum value: NONE = 0;
126+
*/
127+
NONE = 0,
128+
129+
/**
130+
* @generated from enum value: LOL = 1;
131+
*/
132+
LOL = 1,
212133

213-
constructor(data?: PartialMessage<Test>) {
214-
super();
215-
proto3.util.initPartial(data, this);
216-
}
217-
218-
static readonly runtime = proto3;
219-
static readonly typeName = "Test";
220-
static readonly fields: FieldList = proto3.util.newFieldList(() => [
221-
{ no: 6, name: "meh", kind: "message", T: Lol, opt: true },
222-
{ no: 3, name: "hello", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
223-
{ no: 1, name: "foo", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
224-
{ no: 7, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true },
225-
]);
226-
227-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Test {
228-
return new Test().fromBinary(bytes, options);
229-
}
230-
231-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Test {
232-
return new Test().fromJson(jsonValue, options);
233-
}
234-
235-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Test {
236-
return new Test().fromJsonString(jsonString, options);
237-
}
238-
239-
static equals(a: Test | PlainMessage<Test> | undefined, b: Test | PlainMessage<Test> | undefined): boolean {
240-
return proto3.util.equals(Test, a, b);
241-
}
134+
/**
135+
* @generated from enum value: ABE = 3;
136+
*/
137+
ABE = 3,
242138
}
243139

140+
/**
141+
* Describes the enum FOO.
142+
*/
143+
export const FOOSchema: GenEnum<FOO> = /*@__PURE__*/
144+
enumDesc(file_packages_protons_benchmark_src_implementations_bench, 0);
145+

0 commit comments

Comments
 (0)