Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@protobuf-ts/plugin-framework

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@protobuf-ts/plugin-framework - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

56

build/commonjs/descriptor-info.js

@@ -32,3 +32,6 @@ "use strict";

isExtension(fieldDescriptor) {
let parent = this.tree.parentOf(fieldDescriptor);
if (fieldDescriptor.extendee === undefined) {
return false;
}
const parent = this.tree.parentOf(fieldDescriptor);
return parent.extension.includes(fieldDescriptor);

@@ -174,21 +177,24 @@ }

isExplicitlyDeclaredDeprecated(descriptor) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
if (descriptor_1.DescriptorProto.is(descriptor)) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
if (descriptor_1.FileDescriptorProto.is(descriptor)) {
return (_b = (_a = descriptor.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false;
}
if (descriptor_1.FieldDescriptorProto.is(descriptor)) {
if (descriptor_1.DescriptorProto.is(descriptor)) {
return (_d = (_c = descriptor.options) === null || _c === void 0 ? void 0 : _c.deprecated) !== null && _d !== void 0 ? _d : false;
}
if (descriptor_1.EnumDescriptorProto.is(descriptor)) {
if (descriptor_1.FieldDescriptorProto.is(descriptor)) {
return (_f = (_e = descriptor.options) === null || _e === void 0 ? void 0 : _e.deprecated) !== null && _f !== void 0 ? _f : false;
}
if (descriptor_1.EnumValueDescriptorProto.is(descriptor)) {
if (descriptor_1.EnumDescriptorProto.is(descriptor)) {
return (_h = (_g = descriptor.options) === null || _g === void 0 ? void 0 : _g.deprecated) !== null && _h !== void 0 ? _h : false;
}
if (descriptor_1.ServiceDescriptorProto.is(descriptor)) {
if (descriptor_1.EnumValueDescriptorProto.is(descriptor)) {
return (_k = (_j = descriptor.options) === null || _j === void 0 ? void 0 : _j.deprecated) !== null && _k !== void 0 ? _k : false;
}
if (descriptor_1.MethodDescriptorProto.is(descriptor)) {
if (descriptor_1.ServiceDescriptorProto.is(descriptor)) {
return (_m = (_l = descriptor.options) === null || _l === void 0 ? void 0 : _l.deprecated) !== null && _m !== void 0 ? _m : false;
}
if (descriptor_1.MethodDescriptorProto.is(descriptor)) {
return (_p = (_o = descriptor.options) === null || _o === void 0 ? void 0 : _o.deprecated) !== null && _p !== void 0 ? _p : false;
}
if (descriptor_1.OneofDescriptorProto.is(descriptor)) {

@@ -286,4 +292,38 @@ return false;

}
isFileUsed(file, inFiles) {
let used = false;
this.tree.visitTypes(file, typeDescriptor => {
if (used)
return;
if (this.isTypeUsed(typeDescriptor, inFiles)) {
used = true;
}
});
return used;
}
isTypeUsed(type, inFiles) {
let used = false;
for (let fd of inFiles) {
this.tree.visitTypes(fd, typeDescriptor => {
if (used)
return;
if (descriptor_1.DescriptorProto.is(typeDescriptor)) {
const usedInField = typeDescriptor.field.includes(type);
if (usedInField) {
used = true;
}
}
else if (descriptor_1.ServiceDescriptorProto.is(typeDescriptor)) {
const usedInMethodInput = typeDescriptor.method.some(md => this.nameLookup.resolveTypeName(md.inputType) === type);
const usedInMethodOutput = typeDescriptor.method.some(md => this.nameLookup.resolveTypeName(md.outputType) === type);
if (usedInMethodInput || usedInMethodOutput) {
return true;
}
}
});
}
return used;
}
}
exports.DescriptorInfo = DescriptorInfo;
//# sourceMappingURL=descriptor-info.js.map

@@ -144,4 +144,10 @@ "use strict";

}
isFileUsed(file, inFiles) {
return this.descriptorInfo.isFileUsed(file, inFiles);
}
isTypeUsed(type, inFiles) {
return this.descriptorInfo.isTypeUsed(type, inFiles);
}
}
exports.DescriptorRegistry = DescriptorRegistry;
//# sourceMappingURL=descriptor-registry.js.map

@@ -175,2 +175,5 @@ "use strict";

}
if (error && typeof error.name == 'string' && error.name == 'PluginMessageError') {
return error.message;
}
if (util_1.types.isNativeError(error)) {

@@ -177,0 +180,0 @@ return (_a = error.stack) !== null && _a !== void 0 ? _a : error.toString();

7

build/commonjs/symbol-table.js

@@ -78,4 +78,7 @@ "use strict";

}
has(descriptor, b = 'default', kind = 'default') {
return this.find(descriptor, kind) !== undefined;
/**
* Is a name (of the given kind) registered for the the given descriptor?
*/
has(descriptor, kind = 'default') {
return !!this.find(descriptor, kind);
}

@@ -82,0 +85,0 @@ list(file, kind) {

@@ -28,3 +28,6 @@ import { DescriptorProto, EnumDescriptorProto, EnumValueDescriptorProto, FieldDescriptorProto, FieldDescriptorProto_Label, FieldDescriptorProto_Type, FileDescriptorProto, MethodDescriptorProto, OneofDescriptorProto, ServiceDescriptorProto } from "./google/protobuf/descriptor";

isExtension(fieldDescriptor) {
let parent = this.tree.parentOf(fieldDescriptor);
if (fieldDescriptor.extendee === undefined) {
return false;
}
const parent = this.tree.parentOf(fieldDescriptor);
return parent.extension.includes(fieldDescriptor);

@@ -170,21 +173,24 @@ }

isExplicitlyDeclaredDeprecated(descriptor) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
if (DescriptorProto.is(descriptor)) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
if (FileDescriptorProto.is(descriptor)) {
return (_b = (_a = descriptor.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false;
}
if (FieldDescriptorProto.is(descriptor)) {
if (DescriptorProto.is(descriptor)) {
return (_d = (_c = descriptor.options) === null || _c === void 0 ? void 0 : _c.deprecated) !== null && _d !== void 0 ? _d : false;
}
if (EnumDescriptorProto.is(descriptor)) {
if (FieldDescriptorProto.is(descriptor)) {
return (_f = (_e = descriptor.options) === null || _e === void 0 ? void 0 : _e.deprecated) !== null && _f !== void 0 ? _f : false;
}
if (EnumValueDescriptorProto.is(descriptor)) {
if (EnumDescriptorProto.is(descriptor)) {
return (_h = (_g = descriptor.options) === null || _g === void 0 ? void 0 : _g.deprecated) !== null && _h !== void 0 ? _h : false;
}
if (ServiceDescriptorProto.is(descriptor)) {
if (EnumValueDescriptorProto.is(descriptor)) {
return (_k = (_j = descriptor.options) === null || _j === void 0 ? void 0 : _j.deprecated) !== null && _k !== void 0 ? _k : false;
}
if (MethodDescriptorProto.is(descriptor)) {
if (ServiceDescriptorProto.is(descriptor)) {
return (_m = (_l = descriptor.options) === null || _l === void 0 ? void 0 : _l.deprecated) !== null && _m !== void 0 ? _m : false;
}
if (MethodDescriptorProto.is(descriptor)) {
return (_p = (_o = descriptor.options) === null || _o === void 0 ? void 0 : _o.deprecated) !== null && _p !== void 0 ? _p : false;
}
if (OneofDescriptorProto.is(descriptor)) {

@@ -282,3 +288,37 @@ return false;

}
isFileUsed(file, inFiles) {
let used = false;
this.tree.visitTypes(file, typeDescriptor => {
if (used)
return;
if (this.isTypeUsed(typeDescriptor, inFiles)) {
used = true;
}
});
return used;
}
isTypeUsed(type, inFiles) {
let used = false;
for (let fd of inFiles) {
this.tree.visitTypes(fd, typeDescriptor => {
if (used)
return;
if (DescriptorProto.is(typeDescriptor)) {
const usedInField = typeDescriptor.field.includes(type);
if (usedInField) {
used = true;
}
}
else if (ServiceDescriptorProto.is(typeDescriptor)) {
const usedInMethodInput = typeDescriptor.method.some(md => this.nameLookup.resolveTypeName(md.inputType) === type);
const usedInMethodOutput = typeDescriptor.method.some(md => this.nameLookup.resolveTypeName(md.outputType) === type);
if (usedInMethodInput || usedInMethodOutput) {
return true;
}
}
});
}
return used;
}
}
//# sourceMappingURL=descriptor-info.js.map

@@ -141,3 +141,9 @@ import { FileDescriptorProto } from "./google/protobuf/descriptor";

}
isFileUsed(file, inFiles) {
return this.descriptorInfo.isFileUsed(file, inFiles);
}
isTypeUsed(type, inFiles) {
return this.descriptorInfo.isTypeUsed(type, inFiles);
}
}
//# sourceMappingURL=descriptor-registry.js.map

@@ -172,2 +172,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
if (error && typeof error.name == 'string' && error.name == 'PluginMessageError') {
return error.message;
}
if (types.isNativeError(error)) {

@@ -174,0 +177,0 @@ return (_a = error.stack) !== null && _a !== void 0 ? _a : error.toString();

@@ -75,4 +75,7 @@ import { StringFormat } from "./string-format";

}
has(descriptor, b = 'default', kind = 'default') {
return this.find(descriptor, kind) !== undefined;
/**
* Is a name (of the given kind) registered for the the given descriptor?
*/
has(descriptor, kind = 'default') {
return !!this.find(descriptor, kind);
}

@@ -79,0 +82,0 @@ list(file, kind) {

@@ -186,2 +186,17 @@ import { DescriptorProto, EnumDescriptorProto, EnumOptions, EnumValueDescriptorProto, EnumValueOptions, FieldDescriptorProto, FieldDescriptorProto_Type, FieldOptions, FileDescriptorProto, FileOptions, MessageOptions, MethodDescriptorProto, MethodOptions, OneofDescriptorProto, OneofOptions, ServiceDescriptorProto, ServiceOptions } from "./google/protobuf/descriptor";

findEnumSharedPrefix(enumDescriptor: EnumDescriptorProto, enumLocalName?: string): string | undefined;
/**
* Is a top-level type declared in the given file used anywhere the given
* "inFiles"?
*
* Returns true if a type from the file is used in a message field or
* method input or output.
*/
isFileUsed(file: FileDescriptorProto, inFiles: FileDescriptorProto[]): boolean;
/**
* Is the given type used anywhere in the given "inFiles"?
*
* Returns true if the type is used in a message field or method input or
* output.
*/
isTypeUsed(type: AnyTypeDescriptorProto, inFiles: FileDescriptorProto[]): boolean;
}

@@ -215,3 +230,5 @@ export declare class DescriptorInfo implements IDescriptorInfo {

findEnumSharedPrefix(enumDescriptor: EnumDescriptorProto, enumLocalName?: string): string | undefined;
isFileUsed(file: FileDescriptorProto, inFiles: FileDescriptorProto[]): boolean;
isTypeUsed(type: AnyTypeDescriptorProto, inFiles: FileDescriptorProto[]): boolean;
}
//# sourceMappingURL=descriptor-info.d.ts.map

@@ -72,3 +72,5 @@ import { DescriptorProto, EnumDescriptorProto, EnumOptions, EnumValueDescriptorProto, EnumValueOptions, FieldDescriptorProto, FieldOptions, FileDescriptorProto, FileOptions, MessageOptions, MethodDescriptorProto, MethodOptions, OneofDescriptorProto, OneofOptions, ServiceDescriptorProto, ServiceOptions } from "./google/protobuf/descriptor";

shouldBePackedRepeated(descriptor: FieldDescriptorProto): boolean;
isFileUsed(file: FileDescriptorProto, inFiles: FileDescriptorProto[]): boolean;
isTypeUsed(type: AnyTypeDescriptorProto, inFiles: FileDescriptorProto[]): boolean;
}
//# sourceMappingURL=descriptor-registry.d.ts.map

@@ -43,6 +43,2 @@ import { AnyTypeDescriptorProto } from "./descriptor-info";

/**
* Is a name (of the given kind) registered for the given descriptor in the given file?
*/
has(descriptor: AnyTypeDescriptorProto, file: GeneratedFile, kind?: string): boolean;
/**
* List all names of any kind registered in the given file.

@@ -49,0 +45,0 @@ */

{
"name": "@protobuf-ts/plugin-framework",
"version": "1.0.6",
"version": "1.0.7",
"description": "framework to create protoc plugins",

@@ -36,6 +36,6 @@ "license": "(Apache-2.0 AND BSD-3-Clause)",

"dependencies": {
"@protobuf-ts/runtime": "^1.0.6",
"@protobuf-ts/runtime": "^1.0.7",
"typescript": ">=3.8.3 <4"
},
"gitHead": "6848d181abaf33cdb6b713388e56d228d7cb8957"
"gitHead": "2d9220b1db7c0d17fc39faa3851fbc96692bf721"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc