Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

protobufjs-cli

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protobufjs-cli - npm Package Compare versions

Comparing version
1.3.1
to
1.3.2
+7
-0
CHANGELOG.md
# Changelog
## [1.3.2](https://github.com/protobufjs/protobuf.js/compare/protobufjs-cli-v1.3.1...protobufjs-cli-v1.3.2) (2026-05-30)
### Bug Fixes
* Backport consistency and correctness fixes ([#2294](https://github.com/protobufjs/protobuf.js/issues/2294)) ([a92f72e](https://github.com/protobufjs/protobuf.js/commit/a92f72e1cb731f06040a7917d3e041666d5f5601))
## [1.3.1](https://github.com/protobufjs/protobuf.js/compare/protobufjs-cli-v1.3.0...protobufjs-cli-v1.3.1) (2026-05-22)

@@ -4,0 +11,0 @@

+2
-2
{
"name": "protobufjs-cli",
"description": "Translates between file formats and generates static code as well as TypeScript definitions.",
"version": "1.3.1",
"version": "1.3.2",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",

@@ -24,3 +24,3 @@ "repository": {

"peerDependencies": {
"protobufjs": "^7.6.1"
"protobufjs": "^7.6.2"
},

@@ -27,0 +27,0 @@ "dependencies": {

@@ -20,3 +20,3 @@ "use strict";

try {
var rootProp = protobuf.util.safeProp(options.root || "default");
var rootProp = "[" + JSON.stringify(String(options.root || "default")) + "]";
var output = [

@@ -23,0 +23,0 @@ (options.es6 ? "const" : "var") + " $root = ($protobuf.roots" + rootProp + " || ($protobuf.roots" + rootProp + " = new $protobuf.Root()))\n"

@@ -44,3 +44,3 @@ "use strict";

}
var rootProp = util.safeProp(config.root || "default");
var rootProp = "[" + JSON.stringify(String(config.root || "default")) + "]";
push((config.es6 ? "const" : "var") + " $root = $protobuf.roots" + rootProp + " || ($protobuf.roots" + rootProp + " = {});");

@@ -83,2 +83,11 @@ buildNamespace(null, root);

function objectPath(object) {
var parts = [];
while (object && object.name !== "") {
parts.unshift(escapeName(object.name));
object = object.parent;
}
return parts;
}
function exportName(object, asInterface) {

@@ -90,8 +99,5 @@ if (asInterface) {

return object.__exportName;
var parts = object.fullName.substring(1).split("."),
i = 0;
while (i < parts.length)
parts[i] = escapeName(parts[i++]);
if (asInterface)
parts[i - 1] = "I" + parts[i - 1];
var parts = objectPath(object);
if (asInterface && parts.length)
parts[parts.length - 1] = "I" + parts[parts.length - 1];
return object[asInterface ? "__interfaceName" : "__exportName"] = parts.join(".");

@@ -147,3 +153,11 @@ }

var seenNames = new Set();
ns.nestedArray.forEach(function(nested) {
// Only check names of elements that are emitted below
if (!(nested instanceof Enum || nested instanceof Namespace) || nested instanceof Service && !config.service)
return;
var name = escapeName(nested.name);
if (seenNames.has(name))
throw Error("duplicate generated name '" + name + "'");
seenNames.add(name);
if (nested instanceof Enum)

@@ -238,4 +252,23 @@ buildEnum(ns.name, nested);

.replace(/((?!\.)types\[\d+])(\.values)/g, "$1"); // enums: use types[N] instead of reflected types[N].values
var ast = espree.parse(code);
var ast = espree.parse(code);
function rootMemberRef(object) {
var ref = {
"type": "Identifier",
"name": "$root"
};
var parts = objectPath(object);
for (var i = 0; i < parts.length; ++i)
ref = {
"type": "MemberExpression",
"computed": false,
"object": ref,
"property": {
"type": "Identifier",
"name": parts[i]
}
};
return ref;
}
/* eslint-disable no-extra-parens */

@@ -262,6 +295,3 @@ estraverse.replace(ast, {

)
return {
"type": "Identifier",
"name": "$root" + type.fullName
};
return rootMemberRef(type);
// replace types[N] with the field's actual type

@@ -273,6 +303,3 @@ if (

)
return {
"type": "Identifier",
"name": "$root" + type.fieldsArray[node.property.value].resolvedType.fullName
};
return rootMemberRef(type.fieldsArray[node.property.value].resolvedType);
return undefined;

@@ -565,3 +592,3 @@ }

++indent;
push("return this.encode(message, writer).ldelim();");
push("return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();");
--indent;

@@ -568,0 +595,0 @@ push("};");

@@ -118,3 +118,3 @@ "use strict";

if (options.lint !== "")
wrap = "/*" + options.lint + "*/\n" + wrap;
wrap = "/*" + String(options.lint).replace(/\*\//g, "* /") + "*/\n" + wrap;
return wrap.replace(/\r?\n/g, "\n");

@@ -121,0 +121,0 @@ };