@protobuf-ts/plugin-framework
Advanced tools
Comparing version 1.0.7 to 1.0.8-alpha.0
@@ -32,6 +32,3 @@ "use strict"; | ||
isExtension(fieldDescriptor) { | ||
if (fieldDescriptor.extendee === undefined) { | ||
return false; | ||
} | ||
const parent = this.tree.parentOf(fieldDescriptor); | ||
let parent = this.tree.parentOf(fieldDescriptor); | ||
return parent.extension.includes(fieldDescriptor); | ||
@@ -177,24 +174,21 @@ } | ||
isExplicitlyDeclaredDeprecated(descriptor) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; | ||
if (descriptor_1.FileDescriptorProto.is(descriptor)) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
if (descriptor_1.DescriptorProto.is(descriptor)) { | ||
return (_b = (_a = descriptor.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false; | ||
} | ||
if (descriptor_1.DescriptorProto.is(descriptor)) { | ||
if (descriptor_1.FieldDescriptorProto.is(descriptor)) { | ||
return (_d = (_c = descriptor.options) === null || _c === void 0 ? void 0 : _c.deprecated) !== null && _d !== void 0 ? _d : false; | ||
} | ||
if (descriptor_1.FieldDescriptorProto.is(descriptor)) { | ||
if (descriptor_1.EnumDescriptorProto.is(descriptor)) { | ||
return (_f = (_e = descriptor.options) === null || _e === void 0 ? void 0 : _e.deprecated) !== null && _f !== void 0 ? _f : false; | ||
} | ||
if (descriptor_1.EnumDescriptorProto.is(descriptor)) { | ||
if (descriptor_1.EnumValueDescriptorProto.is(descriptor)) { | ||
return (_h = (_g = descriptor.options) === null || _g === void 0 ? void 0 : _g.deprecated) !== null && _h !== void 0 ? _h : false; | ||
} | ||
if (descriptor_1.EnumValueDescriptorProto.is(descriptor)) { | ||
if (descriptor_1.ServiceDescriptorProto.is(descriptor)) { | ||
return (_k = (_j = descriptor.options) === null || _j === void 0 ? void 0 : _j.deprecated) !== null && _k !== void 0 ? _k : false; | ||
} | ||
if (descriptor_1.ServiceDescriptorProto.is(descriptor)) { | ||
if (descriptor_1.MethodDescriptorProto.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)) { | ||
@@ -292,38 +286,4 @@ 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,10 +144,4 @@ "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,5 +175,2 @@ "use strict"; | ||
} | ||
if (error && typeof error.name == 'string' && error.name == 'PluginMessageError') { | ||
return error.message; | ||
} | ||
if (util_1.types.isNativeError(error)) { | ||
@@ -180,0 +177,0 @@ return (_a = error.stack) !== null && _a !== void 0 ? _a : error.toString(); |
@@ -78,7 +78,4 @@ "use strict"; | ||
} | ||
/** | ||
* Is a name (of the given kind) registered for the the given descriptor? | ||
*/ | ||
has(descriptor, kind = 'default') { | ||
return !!this.find(descriptor, kind); | ||
has(descriptor, b = 'default', kind = 'default') { | ||
return this.find(descriptor, kind) !== undefined; | ||
} | ||
@@ -85,0 +82,0 @@ list(file, kind) { |
@@ -28,6 +28,3 @@ import { DescriptorProto, EnumDescriptorProto, EnumValueDescriptorProto, FieldDescriptorProto, FieldDescriptorProto_Label, FieldDescriptorProto_Type, FileDescriptorProto, MethodDescriptorProto, OneofDescriptorProto, ServiceDescriptorProto } from "./google/protobuf/descriptor"; | ||
isExtension(fieldDescriptor) { | ||
if (fieldDescriptor.extendee === undefined) { | ||
return false; | ||
} | ||
const parent = this.tree.parentOf(fieldDescriptor); | ||
let parent = this.tree.parentOf(fieldDescriptor); | ||
return parent.extension.includes(fieldDescriptor); | ||
@@ -173,24 +170,21 @@ } | ||
isExplicitlyDeclaredDeprecated(descriptor) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; | ||
if (FileDescriptorProto.is(descriptor)) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
if (DescriptorProto.is(descriptor)) { | ||
return (_b = (_a = descriptor.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false; | ||
} | ||
if (DescriptorProto.is(descriptor)) { | ||
if (FieldDescriptorProto.is(descriptor)) { | ||
return (_d = (_c = descriptor.options) === null || _c === void 0 ? void 0 : _c.deprecated) !== null && _d !== void 0 ? _d : false; | ||
} | ||
if (FieldDescriptorProto.is(descriptor)) { | ||
if (EnumDescriptorProto.is(descriptor)) { | ||
return (_f = (_e = descriptor.options) === null || _e === void 0 ? void 0 : _e.deprecated) !== null && _f !== void 0 ? _f : false; | ||
} | ||
if (EnumDescriptorProto.is(descriptor)) { | ||
if (EnumValueDescriptorProto.is(descriptor)) { | ||
return (_h = (_g = descriptor.options) === null || _g === void 0 ? void 0 : _g.deprecated) !== null && _h !== void 0 ? _h : false; | ||
} | ||
if (EnumValueDescriptorProto.is(descriptor)) { | ||
if (ServiceDescriptorProto.is(descriptor)) { | ||
return (_k = (_j = descriptor.options) === null || _j === void 0 ? void 0 : _j.deprecated) !== null && _k !== void 0 ? _k : false; | ||
} | ||
if (ServiceDescriptorProto.is(descriptor)) { | ||
if (MethodDescriptorProto.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)) { | ||
@@ -288,37 +282,3 @@ 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,9 +141,3 @@ 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,5 +172,2 @@ 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)) { | ||
@@ -177,0 +174,0 @@ return (_a = error.stack) !== null && _a !== void 0 ? _a : error.toString(); |
@@ -75,7 +75,4 @@ import { StringFormat } from "./string-format"; | ||
} | ||
/** | ||
* Is a name (of the given kind) registered for the the given descriptor? | ||
*/ | ||
has(descriptor, kind = 'default') { | ||
return !!this.find(descriptor, kind); | ||
has(descriptor, b = 'default', kind = 'default') { | ||
return this.find(descriptor, kind) !== undefined; | ||
} | ||
@@ -82,0 +79,0 @@ list(file, kind) { |
@@ -186,17 +186,2 @@ 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; | ||
} | ||
@@ -230,5 +215,3 @@ 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,5 +72,3 @@ 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,2 +43,6 @@ 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. | ||
@@ -45,0 +49,0 @@ */ |
{ | ||
"name": "@protobuf-ts/plugin-framework", | ||
"version": "1.0.7", | ||
"version": "1.0.8-alpha.0", | ||
"description": "framework to create protoc plugins", | ||
@@ -36,6 +36,6 @@ "license": "(Apache-2.0 AND BSD-3-Clause)", | ||
"dependencies": { | ||
"@protobuf-ts/runtime": "^1.0.7", | ||
"@protobuf-ts/runtime": "^1.0.8-alpha.0", | ||
"typescript": ">=3.8.3 <4" | ||
}, | ||
"gitHead": "2d9220b1db7c0d17fc39faa3851fbc96692bf721" | ||
"gitHead": "03507f416313db4611acab63334c1a9126c8d866" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
585085
8391
1