# @protobuf-ts/plugin-framework

> framework to create protoc plugins

Latest version **2.11.0** (published 2025-05-26) · (Apache-2.0 AND BSD-3-Clause) license · 0 weekly downloads

## Install

```sh
npm install @protobuf-ts/plugin-framework
pnpm add @protobuf-ts/plugin-framework
yarn add @protobuf-ts/plugin-framework
bun add @protobuf-ts/plugin-framework
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.11.0 |
| Published | 2025-05-26 |
| First published | 2020-08-13 |
| Weekly downloads | 0 |
| License | (Apache-2.0 AND BSD-3-Clause) |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 459.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1345 |
| Author | Timo Stamm |
| Maintainers | timostamm |
| Keywords | Protocol Buffers, protobuf, TypeScript, protoc |

## Links

- npm: https://www.npmjs.com/package/@protobuf-ts/plugin-framework
- Repository: https://github.com/timostamm/protobuf-ts
- Issues: https://github.com/timostamm/protobuf-ts/issues
- npm.io page: https://npm.io/package/@protobuf-ts/plugin-framework

## Dependencies (2)

- [typescript](https://npm.io/package/typescript.md) ^3.9
- [@protobuf-ts/runtime](https://npm.io/package/@protobuf-ts/runtime.md) ^2.11.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.11.0 (latest) — 2025-05-26
- 2.2.3-alpha.1 (next) — 2022-03-15
- 2.10.0 — 2025-05-01
- 2.9.6 — 2025-03-19
- 2.9.5 — 2025-03-09
- 2.9.4 — 2024-03-13
- 2.9.3 — 2023-12-07
- 2.9.2 — 2023-12-05
- 2.9.1 — 2023-07-31
- 2.9.0 — 2023-04-24
- 2.8.3 — 2023-03-20
- 2.8.2 — 2022-11-16
- 2.8.1 — 2022-09-07
- 2.8.0 — 2022-08-17
- 2.7.0 — 2022-06-16
- … 96 more at https://npm.io/package/@protobuf-ts/plugin-framework/versions

## README

@protobuf-ts/plugin-framework
=============================

> [!IMPORTANT]
> 
> This plugin framework is deprecated.  
> For a good alternative, see [@bufbuild/protoplugin](https://www.npmjs.com/package/@bufbuild/protoplugin)

A framework to create protoc plugins in typescript.

The google protocol buffer compiler (protoc) has a plugin system. With a 
protoc plugin, it is possible to generate code for .proto files in any 
language, not just the ones supported directly by protoc. 

A protoc plugin receives a `CodeGeneratorRequest` (a protobuf message) 
via stdin and returns a `CodeGeneratorResponse` via stdout. 
 
This framework aims to make it as easy as possible to write a protoc 
plugin in typescript. It has special support for generating typescript 
code, but can be used to generate code in other languages. 



### Features

- provides a symbol table that can be used to track generated types 
  in any language
  
- has special support for generating typescript code using the 
  typescript compiler API. For example, it has a simple API to import 
  objects from a package, or from the symbol table.

- provides a base class for plugins that supports parameters, error 
  handling, supported features and easy setup.

- builds a tree of descriptors so that it is trivial to lookup the 
  parent of a nested message, for example.

- builds a lookup object to find the descriptor for a given type name 

- provides a string format object that can print a message field like 
  it was typed by the user.
  
- provides a source code comment lookup that can be used to easily 
  find comments for a given element in a .proto

- provides convenience methods to check if a field was declared 
  optional or as a oneof member 


### Getting started

- Check the types and comments of [descriptor.proto](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto)
  and [plugin.proto](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/compiler/plugin.proto)
  to get familiar with the plugin system of protoc.
- Take a look at `descriptor-registry.ts` to see the if it can help you work with the 
  descriptor protos that the compiler sends you.
- Take a look at `plugin-base.ts` for a base class that can help with some plumbing.


### Copyright

- The files [plugin.ts](https://github.com/timostamm/protobuf-ts/blob/master/packages/plugin-framework/src/google/protobuf/compiler/plugin.ts) and [descriptor.ts](https://github.com/timostamm/protobuf-ts/blob/master/packages/plugin-framework/src/google/protobuf/descriptor.ts) are Copyright 2008 Google Inc., licensed under BSD-3-Clause
- All other files are licensed under Apache-2.0, see [LICENSE](https://github.com/timostamm/protobuf-ts/blob/master/packages/plugin-framework/LICENSE).

---
_Source: https://npm.io/package/@protobuf-ts/plugin-framework · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
