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
2.3.0
to
2.4.0
+98
lib/tsd-jsdoc/patch.js
"use strict";
var typeParserPatched = false;
var typeLinkerPatched = false;
var typeScriptTypePattern = /[&;]|\?:|=>|\bkeyof\b|\btypeof\b/;
function normalizeType(type) {
return type.replace(/\r?\n|\r/g, "\n");
}
function patchTypeExpressionParser(dictionary) {
var type = require("jsdoc/tag/type");
var parse = type.parse,
typeTag = dictionary.lookUp("type");
if (typeTag && !typeTag.protobufjsPatched) {
typeTag.onTagText = function onTypeTagText(text) {
var openIdx = text.indexOf("{"),
closeIdx = text.indexOf("}");
if (openIdx !== 0 || closeIdx <= openIdx + 1)
text = "{" + text + "}";
return text;
};
typeTag.protobufjsPatched = true;
}
if (typeParserPatched)
return;
typeParserPatched = true;
type.parse = function parseTypeScriptType(tagValue, canHaveName, canHaveType) {
try {
return parse(tagValue, canHaveName, canHaveType);
} catch (e) {
if (!canHaveType)
throw e;
var text = String(tagValue || "");
var open = text.indexOf("{");
if (open < 0)
throw e;
var depth = 0;
var close = -1;
for (var i = open; i < text.length; ++i) {
var ch = text.charAt(i);
if (ch === "{")
++depth;
else if (ch === "}" && --depth === 0) {
close = i;
break;
}
}
if (close < 0)
throw e;
var expression = normalizeType(text.substring(open + 1, close)).trim();
if (!typeScriptTypePattern.test(expression) && !/^\s*\{/.test(expression))
throw e;
var name = canHaveName ? text.substring(close + 1).trim() : "";
return {
type: [ expression ],
typeExpression: expression,
name: name
};
}
};
}
function patchTypeExpressionLinks() {
if (typeLinkerPatched)
return;
typeLinkerPatched = true;
var helper = require("jsdoc/util/templateHelper");
var linkto = helper.linkto;
helper.linkto = function linkTypeScriptType(longname, linkText, cssClass, fragmentId) {
var stripped = longname ? String(longname).replace(/^<|>$/g, "") : "";
if (stripped && typeScriptTypePattern.test(stripped) &&
!/^(http|ftp)s?:\/\//.test(stripped) &&
/\{@.+\}/.test(stripped) === false &&
/^<[\s\S]+>/.test(stripped) === false)
return linkText || helper.htmlsafe(longname);
return linkto.call(this, longname, linkText, cssClass, fragmentId);
};
}
exports.normalizeType = normalizeType;
exports.defineTags = function(dictionary) {
patchTypeExpressionParser(dictionary);
patchTypeExpressionLinks();
};
+7
-0
# Changelog
## [2.4.0](https://github.com/protobufjs/protobuf.js/compare/protobufjs-cli-v2.3.0...protobufjs-cli-v2.4.0) (2026-05-18)
### Features
* Support BigInt conversions ([#2257](https://github.com/protobufjs/protobuf.js/issues/2257)) ([36873e6](https://github.com/protobufjs/protobuf.js/commit/36873e69285251a7b6db8d14c8858fc31ef521d8))
## [2.3.0](https://github.com/protobufjs/protobuf.js/compare/protobufjs-cli-v2.2.1...protobufjs-cli-v2.3.0) (2026-05-13)

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

+3
-69
"use strict";
var typeParserPatched = false;
var patch = require("./patch");
function normalizeType(type) {
return type.replace(/\r?\n|\r/g, "\n");
}
function patchTypeScriptTypes(dictionary) {
var type = require("jsdoc/tag/type");
var parse = type.parse,
typeTag = dictionary.lookUp("type");
if (typeTag && !typeTag.protobufjsPatched) {
typeTag.onTagText = function onTypeTagText(text) {
var openIdx = text.indexOf("{"),
closeIdx = text.indexOf("}");
if (openIdx !== 0 || closeIdx <= openIdx + 1)
text = "{" + text + "}";
return text;
};
typeTag.protobufjsPatched = true;
}
if (typeParserPatched)
return;
typeParserPatched = true;
type.parse = function parseTypeScriptType(tagValue, canHaveName, canHaveType) {
try {
return parse(tagValue, canHaveName, canHaveType);
} catch (e) {
if (!canHaveType)
throw e;
var text = String(tagValue || "");
var open = text.indexOf("{");
if (open < 0)
throw e;
var depth = 0;
var close = -1;
for (var i = open; i < text.length; ++i) {
var ch = text.charAt(i);
if (ch === "{")
++depth;
else if (ch === "}" && --depth === 0) {
close = i;
break;
}
}
if (close < 0)
throw e;
var expression = normalizeType(text.substring(open + 1, close)).trim();
if (!/[&;]|\?:|=>|\bkeyof\b|\btypeof\b|^\s*\{/.test(expression))
throw e;
var name = canHaveName ? text.substring(close + 1).trim() : "";
return {
type: [ expression ],
typeExpression: expression,
name: name
};
}
};
}
exports.defineTags = function(dictionary) {
patchTypeScriptTypes(dictionary);
patch.defineTags(dictionary);

@@ -88,5 +22,5 @@ dictionary.defineTag("template", {

onTagged: function(doclet, tag) {
doclet.tsType = normalizeType(tag.text);
doclet.tsType = patch.normalizeType(tag.text);
}
});
};
{
"name": "protobufjs-cli",
"description": "Translates between file formats and generates static code as well as TypeScript definitions.",
"version": "2.3.0",
"version": "2.4.0",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",

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

"peerDependencies": {
"protobufjs": ">=8.2.1 <9"
"protobufjs": ">=8.4.0 <9"
},

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