@bufbuild/protoc-gen-es
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "@bufbuild/protoc-gen-es", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Protocol Buffers code generator for ECMAScript", | ||
@@ -23,6 +23,6 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@bufbuild/protoplugin": "1.0.0" | ||
"@bufbuild/protoplugin": "1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"@bufbuild/protobuf": "1.0.0" | ||
"@bufbuild/protobuf": "1.1.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "peerDependenciesMeta": { |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -326,3 +326,3 @@ // Licensed under the Apache License, Version 2.0 (the "License"); | ||
f.print(" this.", (0, ecmascript_1.localName)(ref.nanos), " = parseInt(nanosStr);"); | ||
f.print(" if (longSeconds < ", protoInt64, ".zero) {"); | ||
f.print(" if (longSeconds < 0 || Object.is(longSeconds, -0)) {"); | ||
f.print(" this.", (0, ecmascript_1.localName)(ref.nanos), " = -this.", (0, ecmascript_1.localName)(ref.nanos), ";"); | ||
@@ -348,2 +348,5 @@ f.print(" }"); | ||
f.print(` text += "." + nanosStr;`); | ||
f.print(" if (this.", (0, ecmascript_1.localName)(ref.nanos), " < 0 && this.", (0, ecmascript_1.localName)(ref.seconds), " === ", protoInt64, ".zero) {"); | ||
f.print(` text = "-" + text;`); | ||
f.print(` }`); | ||
f.print(" }"); | ||
@@ -379,4 +382,7 @@ f.print(` return text + "s";`); | ||
f.print(" return null;"); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.numberValue), `":`); | ||
f.print(` if (!Number.isFinite(this.`, (0, ecmascript_1.localName)(ref.kind), `.value)) {`); | ||
f.print(` throw new Error("google.protobuf.Value cannot be NaN or Infinity");`); | ||
f.print(` }`); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.boolValue), `":`); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.numberValue), `":`); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.stringValue), `":`); | ||
@@ -383,0 +389,0 @@ f.print(" return this.", (0, ecmascript_1.localName)(ref.kind), ".value;"); |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -79,3 +79,3 @@ // Licensed under the Apache License, Version 2.0 (the "License"); | ||
generateWktMethods(schema, f, message); | ||
f.print(" static readonly runtime = ", protoN, ";"); | ||
f.print(" static readonly runtime: typeof ", protoN, " = ", protoN, ";"); | ||
f.print(' static readonly typeName = ', (0, ecmascript_2.literalString)(message.typeName), ';'); | ||
@@ -328,3 +328,3 @@ f.print(" static readonly fields: ", FieldList, " = ", protoN, ".util.newFieldList(() => ["); | ||
f.print(" this.", (0, ecmascript_1.localName)(ref.nanos), " = parseInt(nanosStr);"); | ||
f.print(" if (longSeconds < ", protoInt64, ".zero) {"); | ||
f.print(" if (longSeconds < 0 || Object.is(longSeconds, -0)) {"); | ||
f.print(" this.", (0, ecmascript_1.localName)(ref.nanos), " = -this.", (0, ecmascript_1.localName)(ref.nanos), ";"); | ||
@@ -350,2 +350,5 @@ f.print(" }"); | ||
f.print(` text += "." + nanosStr;`); | ||
f.print(" if (this.", (0, ecmascript_1.localName)(ref.nanos), " < 0 && this.", (0, ecmascript_1.localName)(ref.seconds), " === ", protoInt64, ".zero) {"); | ||
f.print(` text = "-" + text;`); | ||
f.print(` }`); | ||
f.print(" }"); | ||
@@ -381,4 +384,9 @@ f.print(` return text + "s";`); | ||
f.print(" return null;"); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.numberValue), `":`); | ||
f.print(` if (!Number.isFinite(this.`, (0, ecmascript_1.localName)(ref.kind), `.value)) {`); | ||
f.print(` throw new Error("google.protobuf.Value cannot be NaN or Infinity");`); | ||
f.print(` }`); | ||
f.print(` return this.`, (0, ecmascript_1.localName)(ref.kind), `.value;`); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.boolValue), `":`); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.numberValue), `":`); | ||
f.print(` return this.`, (0, ecmascript_1.localName)(ref.kind), `.value;`); | ||
f.print(` case "`, (0, ecmascript_1.localName)(ref.stringValue), `":`); | ||
@@ -385,0 +393,0 @@ f.print(" return this.", (0, ecmascript_1.localName)(ref.kind), ".value;"); |
{ | ||
"name": "@bufbuild/protoc-gen-es", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Protocol Buffers code generator for ECMAScript", | ||
@@ -23,6 +23,6 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@bufbuild/protoplugin": "1.0.0" | ||
"@bufbuild/protoplugin": "1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"@bufbuild/protobuf": "1.0.0" | ||
"@bufbuild/protobuf": "1.1.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "peerDependenciesMeta": { |
@@ -1,2 +0,2 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -1,2 +0,2 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -339,3 +339,3 @@ // Licensed under the Apache License, Version 2.0 (the "License"); | ||
f.print(" this.", localName(ref.nanos), " = parseInt(nanosStr);") | ||
f.print(" if (longSeconds < ", protoInt64, ".zero) {") | ||
f.print(" if (longSeconds < 0 || Object.is(longSeconds, -0)) {"); | ||
f.print(" this.", localName(ref.nanos), " = -this.", localName(ref.nanos), ";") | ||
@@ -361,2 +361,5 @@ f.print(" }") | ||
f.print(` text += "." + nanosStr;`) | ||
f.print(" if (this.", localName(ref.nanos), " < 0 && this.", localName(ref.seconds), " === ", protoInt64, ".zero) {"); | ||
f.print(` text = "-" + text;`); | ||
f.print(` }`); | ||
f.print(" }") | ||
@@ -392,4 +395,7 @@ f.print(` return text + "s";`) | ||
f.print(" return null;") | ||
f.print(` case "`, localName(ref.numberValue), `":`) | ||
f.print(` if (!Number.isFinite(this.`, localName(ref.kind), `.value)) {`); | ||
f.print(` throw new Error("google.protobuf.Value cannot be NaN or Infinity");`); | ||
f.print(` }`); | ||
f.print(` case "`, localName(ref.boolValue), `":`) | ||
f.print(` case "`, localName(ref.numberValue), `":`) | ||
f.print(` case "`, localName(ref.stringValue), `":`) | ||
@@ -396,0 +402,0 @@ f.print(" return this.", localName(ref.kind), ".value;") |
@@ -1,2 +0,2 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -1,2 +0,2 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// Copyright 2021-2023 Buf Technologies, Inc. | ||
// | ||
@@ -104,3 +104,3 @@ // Licensed under the Apache License, Version 2.0 (the "License"); | ||
generateWktMethods(schema, f, message); | ||
f.print(" static readonly runtime = ", protoN, ";"); | ||
f.print(" static readonly runtime: typeof ", protoN, " = ", protoN, ";"); | ||
f.print(' static readonly typeName = ', literalString(message.typeName), ';'); | ||
@@ -365,3 +365,3 @@ f.print(" static readonly fields: ", FieldList, " = ", protoN, ".util.newFieldList(() => ["); | ||
f.print(" this.", localName(ref.nanos), " = parseInt(nanosStr);") | ||
f.print(" if (longSeconds < ", protoInt64, ".zero) {") | ||
f.print(" if (longSeconds < 0 || Object.is(longSeconds, -0)) {"); | ||
f.print(" this.", localName(ref.nanos), " = -this.", localName(ref.nanos), ";") | ||
@@ -387,2 +387,5 @@ f.print(" }") | ||
f.print(` text += "." + nanosStr;`) | ||
f.print(" if (this.", localName(ref.nanos), " < 0 && this.", localName(ref.seconds), " === ", protoInt64, ".zero) {"); | ||
f.print(` text = "-" + text;`); | ||
f.print(` }`); | ||
f.print(" }") | ||
@@ -418,4 +421,9 @@ f.print(` return text + "s";`) | ||
f.print(" return null;") | ||
f.print(` case "`, localName(ref.numberValue), `":`) | ||
f.print(` if (!Number.isFinite(this.`, localName(ref.kind), `.value)) {`); | ||
f.print(` throw new Error("google.protobuf.Value cannot be NaN or Infinity");`); | ||
f.print(` }`); | ||
f.print(` return this.`, localName(ref.kind), `.value;`); | ||
f.print(` case "`, localName(ref.boolValue), `":`) | ||
f.print(` case "`, localName(ref.numberValue), `":`) | ||
f.print(` return this.`, localName(ref.kind), `.value;`); | ||
f.print(` case "`, localName(ref.stringValue), `":`) | ||
@@ -422,0 +430,0 @@ f.print(" return this.", localName(ref.kind), ".value;") |
147297
2887
+ Added@bufbuild/protobuf@1.1.0(transitive)
+ Added@bufbuild/protoplugin@1.1.0(transitive)
- Removed@bufbuild/protobuf@1.0.0(transitive)
- Removed@bufbuild/protoplugin@1.0.0(transitive)
Updated@bufbuild/protoplugin@1.1.0