proto-parser is a JavaScript/TypeScript library specifically designed to parse Protocol Buffer (proto) files and generate an Abstract Syntax Tree (AST). Currently at version 0.0.9, it is in early development, suggesting potential for rapid updates and API evolution, though no explicit release cadence is mentioned beyond frequent updates. Unlike `protobuf.js`, on which it is partially based and from which it reuses some code, `proto-parser` focuses exclusively on the parsing aspect, omitting encoding/decoding functionalities. This specialization results in a smaller codebase, improved performance, and a 'purer' AST structure. It offers native TypeScript support and aims for basic AST compatibility with `protobuf.js`, making it suitable for users who primarily need to analyze or transform proto definitions without the overhead of runtime message handling.
npm install proto-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a proto3 file content string into an AST, with options.
Refer to the latest README and changelog (if available) for up-to-date API usage. Pin exact versions for stability.
Thoroughly test any code that processes the AST generated by `proto-parser` if it was originally designed for `protobuf.js`'s AST. Inspect the generated AST structure carefully.
For message encoding/decoding, consider using `protobuf.js` or Google's official `google-protobuf` library in conjunction with `proto-parser` if AST generation is a separate requirement.
For ESM, use `import * as t from 'proto-parser';` then `t.parse(...)`. For CommonJS, use `const protoParser = require('proto-parser');` then `protoParser.parse(...)`.For TypeScript, use `import type { ProtoDocument } from 'proto-parser';` for explicit type imports, or access it via a namespace import like `t.ProtoDocument` if you've done `import * as t from 'proto-parser';`.Review the proto content string for syntax errors, missing semicolons, incorrect keywords, or incomplete definitions. Ensure it's a valid proto3 or proto2 file content.
No dependency data recorded yet.