Skip to content

Commit

Permalink
Updates from review
Browse files Browse the repository at this point in the history
  • Loading branch information
rakuista committed Jul 16, 2024
1 parent 6fd7e22 commit cc2ad8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
17 changes: 5 additions & 12 deletions MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,6 @@ the previous version. In general, the binary format is also more performant than

### Binary serialization options

TODO: Examples to show these in context?

Options for `toBinary`:

- `writeUnknownFields?: boolean`<br/>
Expand Down Expand Up @@ -1703,9 +1701,6 @@ plugin provides. The Protobuf compiler parses the Protobuf files and invokes the
[descriptors](#descriptors)—an abstract version of the parsed Protobuf files. The response contains a list of
files, each with a name and text content.

For more information on how plugins work, check out [the Buf image documentation][buf-images].
TODO: Is this still the best place to link to? It's pretty Buf-specific in this more general context.

The main step in the process is to pass a plugin initialization object to the `createEcmaScriptPlugin` function
exported by the plugin framework. This plugin initialization object contains various properties about different
aspects of your plugin.
Expand Down Expand Up @@ -2144,7 +2139,7 @@ string fields as the one above, but also repeated fields, message fields, etc.
Take a look at our [plugin example](./packages/protoplugin-example/)
to see the custom option above in action and run the code yourself.
## Testing
### Testing plugins
We recommend testing generated code just like handwritten code. Identify a representative Protobuf file for your use
case, generate code, and then run tests against the generated code. If you implement your own generator functions for
Expand All @@ -2157,12 +2152,10 @@ For a small example of generating a Twirp client based on a simple service defin
Additionally, check out [protoc-gen-es](https://github.com/bufbuild/protobuf-es/tree/main/packages/protoc-gen-es), which is the official code generator for Protobuf-ES.
## Examples
> **TODO** packages/protobuf-example contains a runnable example that uses the same example.User definition we've been using in this doc. We should link to it.
## Migrating to Protobuf-ES
TODO: Need to update migration.md and move to this doc
For a runnable example that uses Protocol Buffers to manage a list of users, see
[packages/protobuf-example](packages/protobuf-example). For a custom plugin, see
[packages/protoplugin-example](packages/protoplugin-example). It generates Twirp clients for your services, and also
uses [custom options](#custom-options).
## FAQs
Expand Down
6 changes: 3 additions & 3 deletions packages/protoc-gen-es/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ most compatible with various bundler configurations. If you prefer to generate T

### `import_extension`

By default, [protoc-gen-es][@bufbuild/protoc-gen-es] doesn't add file extensions to import paths. However, some
environments require an import extension. For example, using [ECMAScript modules in Node.js][ecmascript-modules]
By default, `protoc-gen-es` doesn't add file extensions to import paths. However, some
environments require an import extension. For example, using ECMAScript modules in Node.js
requires the `.js` extension, and Deno requires `.ts`. With this plugin option, you can add `.js`/`.ts` extensions in
import paths with the given value. Possible values:

Expand Down Expand Up @@ -121,4 +121,4 @@ the top of each file to skip type checks: `// @ts-nocheck`.
### `json_types=true`

Generates JSON types for every Protobuf message and enumeration. Calling `toJson()` automatically returns the JSON type
if available. Learn more about [JSON types](#json-types).
if available. Learn more about [JSON types](https://github.com/bufbuild/protobuf-es/blob/main/MANUAL.md#json-types).

0 comments on commit cc2ad8f

Please sign in to comment.