@bufbuild/protoc-gen-es
Advanced tools
Comparing version 2.2.1 to 2.2.2
{ | ||
"name": "@bufbuild/protoc-gen-es", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"license": "Apache-2.0", | ||
@@ -33,7 +33,7 @@ "description": "Protocol Buffers code generator for ECMAScript", | ||
"dependencies": { | ||
"@bufbuild/protobuf": "^2.2.1", | ||
"@bufbuild/protoplugin": "2.2.1" | ||
"@bufbuild/protobuf": "^2.2.2", | ||
"@bufbuild/protoplugin": "2.2.2" | ||
}, | ||
"peerDependencies": { | ||
"@bufbuild/protobuf": "2.2.1" | ||
"@bufbuild/protobuf": "2.2.2" | ||
}, | ||
@@ -40,0 +40,0 @@ "peerDependenciesMeta": { |
@@ -450,15 +450,12 @@ "use strict"; | ||
for (const field of message.fields) { | ||
switch (field.kind) { | ||
default: | ||
f.print(f.jsDoc(field, " ")); | ||
// eslint-disable-next-line no-case-declarations | ||
let jsonName = field.jsonName; | ||
if (jsonName === "" | ||
|| /^[0-9]/.test(jsonName) | ||
|| jsonName.indexOf("@") > -1) { | ||
jsonName = f.string(jsonName); | ||
} | ||
f.print(" ", jsonName, "?: ", (0, util_1.fieldJsonType)(field), ";"); | ||
break; | ||
f.print(f.jsDoc(field, " ")); | ||
let jsonName = field.jsonName; | ||
const startWithNumber = /^[0-9]/; | ||
const containsSpecialChar = /[^a-zA-Z0-9_$]/; | ||
if (jsonName === "" | ||
|| startWithNumber.test(jsonName) | ||
|| containsSpecialChar.test(jsonName)) { | ||
jsonName = f.string(jsonName); | ||
} | ||
f.print(" ", jsonName, "?: ", (0, util_1.fieldJsonType)(field), ";"); | ||
if (message.fields.indexOf(field) < message.fields.length - 1) { | ||
@@ -465,0 +462,0 @@ f.print(); |
{ | ||
"name": "@bufbuild/protoc-gen-es", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"license": "Apache-2.0", | ||
@@ -33,7 +33,7 @@ "description": "Protocol Buffers code generator for ECMAScript", | ||
"dependencies": { | ||
"@bufbuild/protobuf": "^2.2.1", | ||
"@bufbuild/protoplugin": "2.2.1" | ||
"@bufbuild/protobuf": "^2.2.2", | ||
"@bufbuild/protoplugin": "2.2.2" | ||
}, | ||
"peerDependencies": { | ||
"@bufbuild/protobuf": "2.2.1" | ||
"@bufbuild/protobuf": "2.2.2" | ||
}, | ||
@@ -40,0 +40,0 @@ "peerDependenciesMeta": { |
35037
683
+ Added@bufbuild/protobuf@2.2.2(transitive)
+ Added@bufbuild/protoplugin@2.2.2(transitive)
- Removed@bufbuild/protobuf@2.2.1(transitive)
- Removed@bufbuild/protoplugin@2.2.1(transitive)
Updated@bufbuild/protobuf@^2.2.2
Updated@bufbuild/protoplugin@2.2.2