Registry / devops / resolve-protobuf-schema

resolve-protobuf-schema

JSON →
library2.1.0jsnpmunverified

Reads a protobuf schema from disk, parses it, and resolves all imports, producing a combined parsed schema. Current stable version is 2.1.0, with no recent updates. It is a lightweight utility for Node.js environments, offering both async and sync API. Unlike other protobuf parsers, it focuses solely on schema resolution without parsing .proto files into runtime objects. Requires protobufjs (peek-readable) for parsing. Release cadence is low; no breaking changes expected.

npm install resolve-protobuf-schema
INSTALL
IMPORT
SIG · RESOLVE-PROTOBUF-S
R
resolve-protobuf-schema
devopsjavascriptv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sync
✓ import { sync } from 'resolve-protobuf-schema'
✗ const sync = require('resolve-protobuf-schema').sync
ESM available; named export. CommonJS still works but use destructuring for consistency.
resolve (default)
✓ import resolve from 'resolve-protobuf-schema'
✗ const resolve = require('resolve-protobuf-schema'); resolve() is fine but default import is ESM style.
Default export is the async resolve function. For sync, use named export.
TypeScript type definitions
✓ import type { SyncResult } from 'resolve-protobuf-schema'
Type definitions are not bundled; use @types or define manually.

Demonstrates synchronous resolution of a .proto file, returning a parsed schema object with resolved imports.

import { sync } from 'resolve-protobuf-schema'; const schema = sync('path/to/schema.proto'); console.log(JSON.stringify(schema, null, 2));
Debug
Known issues
gotchaThe schema file path is relative to process.cwd() by default, not the module's directory.
fix
Always provide absolute paths or paths relative to process.cwd().
affects: >=2.0.0
gotchaImports in .proto files are resolved using the same base directory as the file being resolved, not the current working directory.
fix
Ensure imported files exist relative to the importing file's location.
affects: >=2.0.0
deprecatedThe package is not actively maintained; last version 2.1.0 was released in 2019.
fix
Consider alternatives like protobufjs that include schema resolution.
affects: >=2.0.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '...'
File path provided is incorrect or non-existent relative to process.cwd().
fix
Use an absolute path or check the relative path from the working directory.
TypeError: resolve is not a function
Importing incorrectly, e.g., using named import for default export.
fix
Use `import resolve from 'resolve-protobuf-schema'` for async, or `import { sync } from '...'` for sync.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
peek-readablerequiredUsed internally to read and parse protobuf files; not directly exposed but required at runtime.
Agent activity
4 hits · last 30 days
node
4
Resources
resolve-protobuf-schema — npm install resolve-protobuf-schema · libregistry