@bufbuild/protoplugin 2.12.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This package helps you create your own code generator plugin using the
|
|
4
4
|
Protobuf-ES plugin framework.
|
|
5
5
|
|
|
6
|
-
**Protobuf-ES** is a complete implementation of [Protocol Buffers](https://protobuf.dev) in TypeScript, suitable for web browsers, Node.js, and
|
|
6
|
+
**Protobuf-ES** is a complete implementation of [Protocol Buffers](https://protobuf.dev) in TypeScript, suitable for web browsers, Node.js, Deno, and Bun.
|
|
7
7
|
|
|
8
8
|
In addition to a full Protobuf runtime library, it provides the [`protoc-gen-es`](https://www.npmjs.com/package/@bufbuild/protoc-gen-es)
|
|
9
9
|
code generator, which uses a plugin framework to generate base types from
|
|
@@ -61,9 +61,9 @@ function makeFilePreamble(file, pluginName, pluginVersion, parameter, tsNoCheck)
|
|
|
61
61
|
// Report the raw edition from the descriptor so files using
|
|
62
62
|
// EDITION_UNSTABLE (which we collapse to maximumEdition internally)
|
|
63
63
|
// still render as "edition unstable".
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
const e =
|
|
64
|
+
const editionValue = wkt_1.EditionSchema.value[file.proto.edition];
|
|
65
|
+
if (editionValue !== undefined) {
|
|
66
|
+
const e = editionValue.name.replace("EDITION_", "").toLowerCase();
|
|
67
67
|
builder.push(`edition ${e})\n`);
|
|
68
68
|
}
|
|
69
69
|
else {
|
package/dist/cjs/schema.js
CHANGED
|
@@ -121,8 +121,9 @@ function getFilesToGenerate(request, minimumEdition, maximumEdition) {
|
|
|
121
121
|
return { allFiles, filesToGenerate };
|
|
122
122
|
}
|
|
123
123
|
function editionToString(edition) {
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
const value = wkt_1.EditionSchema.values.find((e) => e.number == edition);
|
|
125
|
+
if (value !== undefined) {
|
|
126
|
+
return value.name.replace(/^EDITION_/, "");
|
|
126
127
|
}
|
|
127
128
|
return `unknown (${edition})`;
|
|
128
129
|
}
|
|
@@ -213,7 +213,8 @@ function getDeclarationString(desc) {
|
|
|
213
213
|
}
|
|
214
214
|
if (protoOptions !== undefined &&
|
|
215
215
|
(0, protobuf_1.isFieldSet)(protoOptions, wkt_1.FieldOptionsSchema.field.jstype)) {
|
|
216
|
-
|
|
216
|
+
const value = wkt_1.FieldOptions_JSTypeSchema.value[protoOptions.jstype];
|
|
217
|
+
options.push(`jstype = ${value.name}`);
|
|
217
218
|
}
|
|
218
219
|
if (protoOptions !== undefined &&
|
|
219
220
|
(0, protobuf_1.isFieldSet)(protoOptions, wkt_1.FieldOptionsSchema.field.deprecated)) {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Edition } from "@bufbuild/protobuf/wkt";
|
|
14
|
+
import { Edition, EditionSchema } from "@bufbuild/protobuf/wkt";
|
|
15
15
|
import { getPackageComments, getSyntaxComments, getFeatureOptionStrings, } from "./source-code-info.js";
|
|
16
16
|
export function makeFilePreamble(file, pluginName, pluginVersion, parameter, tsNoCheck) {
|
|
17
17
|
const builder = [];
|
|
@@ -58,9 +58,9 @@ export function makeFilePreamble(file, pluginName, pluginVersion, parameter, tsN
|
|
|
58
58
|
// Report the raw edition from the descriptor so files using
|
|
59
59
|
// EDITION_UNSTABLE (which we collapse to maximumEdition internally)
|
|
60
60
|
// still render as "edition unstable".
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const e =
|
|
61
|
+
const editionValue = EditionSchema.value[file.proto.edition];
|
|
62
|
+
if (editionValue !== undefined) {
|
|
63
|
+
const e = editionValue.name.replace("EDITION_", "").toLowerCase();
|
|
64
64
|
builder.push(`edition ${e})\n`);
|
|
65
65
|
}
|
|
66
66
|
else {
|
package/dist/esm/schema.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
import { create, createFileRegistry } from "@bufbuild/protobuf";
|
|
15
|
-
import { Edition, FileDescriptorSetSchema } from "@bufbuild/protobuf/wkt";
|
|
15
|
+
import { Edition, EditionSchema, FileDescriptorSetSchema, } from "@bufbuild/protobuf/wkt";
|
|
16
16
|
import { nestedTypes } from "@bufbuild/protobuf/reflect";
|
|
17
17
|
import { createGeneratedFile } from "./generated-file.js";
|
|
18
18
|
import { createImportSymbol } from "./import-symbol.js";
|
|
@@ -118,8 +118,9 @@ function getFilesToGenerate(request, minimumEdition, maximumEdition) {
|
|
|
118
118
|
return { allFiles, filesToGenerate };
|
|
119
119
|
}
|
|
120
120
|
function editionToString(edition) {
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
const value = EditionSchema.values.find((e) => e.number == edition);
|
|
122
|
+
if (value !== undefined) {
|
|
123
|
+
return value.name.replace(/^EDITION_/, "");
|
|
123
124
|
}
|
|
124
125
|
return `unknown (${edition})`;
|
|
125
126
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
import { isFieldSet, ScalarType, } from "@bufbuild/protobuf";
|
|
15
15
|
import { protoCamelCase, reflect } from "@bufbuild/protobuf/reflect";
|
|
16
|
-
import { Edition, FieldDescriptorProto_Label, FieldDescriptorProto_Type, FieldDescriptorProtoSchema,
|
|
16
|
+
import { Edition, FieldDescriptorProto_Label, FieldDescriptorProto_Type, FieldDescriptorProtoSchema, FieldOptionsSchema, FeatureSetSchema, SourceCodeInfo_LocationSchema, FileDescriptorProtoSchema, DescriptorProtoSchema, EnumDescriptorProtoSchema, ServiceDescriptorProtoSchema, FieldOptions_JSTypeSchema, } from "@bufbuild/protobuf/wkt";
|
|
17
17
|
/**
|
|
18
18
|
* Get comments on the package element in the protobuf source.
|
|
19
19
|
*/
|
|
@@ -206,7 +206,8 @@ export function getDeclarationString(desc) {
|
|
|
206
206
|
}
|
|
207
207
|
if (protoOptions !== undefined &&
|
|
208
208
|
isFieldSet(protoOptions, FieldOptionsSchema.field.jstype)) {
|
|
209
|
-
|
|
209
|
+
const value = FieldOptions_JSTypeSchema.value[protoOptions.jstype];
|
|
210
|
+
options.push(`jstype = ${value.name}`);
|
|
210
211
|
}
|
|
211
212
|
if (protoOptions !== undefined &&
|
|
212
213
|
isFieldSet(protoOptions, FieldOptionsSchema.field.deprecated)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bufbuild/protoplugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Helps to create your own Protocol Buffers code generators.",
|
|
6
6
|
"keywords": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@bufbuild/protobuf": "2.
|
|
39
|
+
"@bufbuild/protobuf": "2.13.0",
|
|
40
40
|
"@typescript/vfs": "^1.6.2",
|
|
41
41
|
"typescript": "5.4.5"
|
|
42
42
|
},
|