@bufbuild/protoc-gen-es 2.0.0-beta.1 → 2.0.0-beta.2

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
@@ -1,11 +1,11 @@
1
1
  # @bufbuild/protoc-gen-es
2
2
 
3
- The code generator plugin for Protocol Buffers for ECMAScript. Learn more about the project at [github.com/bufbuild/protobuf-es](https://github.com/bufbuild/protobuf-es).
3
+ The code generator plugin for Protocol Buffers for ECMAScript. Learn more about the project at [github.com/bufbuild/protobuf-es](https://github.com/bufbuild/protobuf-es).
4
4
 
5
5
  ## Installation
6
6
 
7
7
  `protoc-gen-es` generates base types - messages and enumerations - from your Protocol Buffer
8
- schema. The generated code requires the runtime library [@bufbuild/protobuf](https://www.npmjs.com/package/@bufbuild/protobuf). It is compatible with Protocol Buffer compilers like [buf](https://github.com/bufbuild/buf) and [protoc](https://github.com/protocolbuffers/protobuf/releases).
8
+ schema. The generated code requires the runtime library [@bufbuild/protobuf](https://www.npmjs.com/package/@bufbuild/protobuf). It is compatible with Protocol Buffer compilers like [buf](https://github.com/bufbuild/buf) and [protoc](https://github.com/protocolbuffers/protobuf/releases).
9
9
 
10
10
  To install the plugin and the runtime library, run:
11
11
 
@@ -18,7 +18,6 @@ We use peer dependencies to ensure that code generator and runtime library are
18
18
  compatible with each other. Note that npm installs them automatically, but yarn
19
19
  and pnpm do not.
20
20
 
21
-
22
21
  ## Generating code
23
22
 
24
23
  ### With buf
@@ -51,7 +50,6 @@ npx buf generate
51
50
  Note that `buf` can generate from various [inputs](https://docs.buf.build/reference/inputs),
52
51
  not just local protobuf files.
53
52
 
54
-
55
53
  ### With protoc
56
54
 
57
55
  ```bash
@@ -80,6 +78,7 @@ This option controls whether the plugin generates JavaScript, TypeScript,
80
78
  or TypeScript declaration files.
81
79
 
82
80
  Possible values:
81
+
83
82
  - `target=js` - generates a `_pb.js` file for every `.proto` input file.
84
83
  - `target=ts` - generates a `_pb.ts` file for every `.proto` input file.
85
84
  - `target=dts` - generates a `_pb.d.ts` file for every `.proto` input file.
@@ -113,6 +112,7 @@ CommonJS is difficult to avoid, this option can be used to generate CommonJS
113
112
  `require()` calls.
114
113
 
115
114
  Possible values:
115
+
116
116
  - `js_import_style=module` generate ECMAScript `import` / `export` statements -
117
117
  the default behavior.
118
118
  - `js_import_style=legacy_commonjs` generate CommonJS `require()` calls.
package/bin/protoc-gen-es CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const {runNodeJs} = require("@bufbuild/protoplugin");
4
- const {protocGenEs} = require("../dist/cjs/src/protoc-gen-es-plugin.js");
3
+ const { runNodeJs } = require("@bufbuild/protoplugin");
4
+ const { protocGenEs } = require("../dist/cjs/src/protoc-gen-es-plugin.js");
5
5
 
6
6
  runNodeJs(protocGenEs);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protoc-gen-es",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "Protocol Buffers code generator for ECMAScript",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,16 +15,19 @@
15
15
  "node": ">=14"
16
16
  },
17
17
  "scripts": {
18
- "clean": "rm -rf ./dist/cjs/*",
19
- "build": "../../node_modules/typescript/bin/tsc --project tsconfig.json --outDir ./dist/cjs"
18
+ "prebuild": "rm -rf ./dist/cjs/*",
19
+ "build": "../../node_modules/typescript/bin/tsc --project tsconfig.json --outDir ./dist/cjs",
20
+ "format": "prettier --write --ignore-unknown '.' '!dist' '!.turbo'",
21
+ "license-header": "license-header",
22
+ "lint": "eslint --max-warnings 0 ."
20
23
  },
21
24
  "preferUnplugged": true,
22
25
  "dependencies": {
23
- "@bufbuild/protobuf": "^2.0.0-beta.1",
24
- "@bufbuild/protoplugin": "2.0.0-beta.1"
26
+ "@bufbuild/protobuf": "^2.0.0-beta.2",
27
+ "@bufbuild/protoplugin": "2.0.0-beta.2"
25
28
  },
26
29
  "peerDependencies": {
27
- "@bufbuild/protobuf": "2.0.0-beta.1"
30
+ "@bufbuild/protobuf": "2.0.0-beta.2"
28
31
  },
29
32
  "peerDependenciesMeta": {
30
33
  "@bufbuild/protobuf": {
@@ -0,0 +1 @@
1
+ export declare const protocGenEs: import("@bufbuild/protoplugin").Plugin;
@@ -0,0 +1,9 @@
1
+ import { type DescExtension, type DescField } from "@bufbuild/protobuf";
2
+ import type { GeneratedFile, Printable } from "@bufbuild/protoplugin";
3
+ export declare function fieldTypeScriptType(field: DescField | DescExtension, imports: GeneratedFile["runtime"]): {
4
+ typing: Printable;
5
+ optional: boolean;
6
+ };
7
+ export declare function fieldJsonType(field: DescField | DescExtension): Printable;
8
+ export declare function functionCall(fn: Printable, args: Printable[], typeParams?: Printable[]): Printable;
9
+ export declare function arrayLiteral(elements: Printable[]): Printable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protoc-gen-es",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "Protocol Buffers code generator for ECMAScript",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,16 +15,19 @@
15
15
  "node": ">=14"
16
16
  },
17
17
  "scripts": {
18
- "clean": "rm -rf ./dist/cjs/*",
19
- "build": "../../node_modules/typescript/bin/tsc --project tsconfig.json --outDir ./dist/cjs"
18
+ "prebuild": "rm -rf ./dist/cjs/*",
19
+ "build": "../../node_modules/typescript/bin/tsc --project tsconfig.json --outDir ./dist/cjs",
20
+ "format": "prettier --write --ignore-unknown '.' '!dist' '!.turbo'",
21
+ "license-header": "license-header",
22
+ "lint": "eslint --max-warnings 0 ."
20
23
  },
21
24
  "preferUnplugged": true,
22
25
  "dependencies": {
23
- "@bufbuild/protobuf": "^2.0.0-beta.1",
24
- "@bufbuild/protoplugin": "2.0.0-beta.1"
26
+ "@bufbuild/protobuf": "^2.0.0-beta.2",
27
+ "@bufbuild/protoplugin": "2.0.0-beta.2"
25
28
  },
26
29
  "peerDependencies": {
27
- "@bufbuild/protobuf": "2.0.0-beta.1"
30
+ "@bufbuild/protobuf": "2.0.0-beta.2"
28
31
  },
29
32
  "peerDependenciesMeta": {
30
33
  "@bufbuild/protobuf": {