1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 10:46:01 +00:00
This commit is contained in:
MatteZ02
2020-03-03 22:30:50 +02:00
parent edfcc6f474
commit 30022c7634
11800 changed files with 1984416 additions and 1 deletions

4
node_modules/protobufjs/ext/debug/README.md generated vendored Normal file
View File

@ -0,0 +1,4 @@
protobufjs/ext/debug
=========================
Experimental debugging extension.

71
node_modules/protobufjs/ext/debug/index.js generated vendored Normal file
View File

@ -0,0 +1,71 @@
"use strict";
var protobuf = require("../..");
/**
* Debugging utility functions. Only present in debug builds.
* @namespace
*/
var debug = protobuf.debug = module.exports = {};
var codegen = protobuf.util.codegen;
var debugFnRe = /function ([^(]+)\(([^)]*)\) {/g;
// Counts number of calls to any generated function
function codegen_debug() {
codegen_debug.supported = codegen.supported;
codegen_debug.verbose = codegen.verbose;
var gen = codegen.apply(null, Array.prototype.slice.call(arguments));
gen.str = (function(str) { return function str_debug() {
return str.apply(null, Array.prototype.slice.call(arguments)).replace(debugFnRe, "function $1($2) {\n\t$1.calls=($1.calls|0)+1");
};})(gen.str);
return gen;
}
/**
* Returns a list of unused types within the specified root.
* @param {NamespaceBase} ns Namespace to search
* @returns {Type[]} Unused types
*/
debug.unusedTypes = function unusedTypes(ns) {
/* istanbul ignore if */
if (!(ns instanceof protobuf.Namespace))
throw TypeError("ns must be a Namespace");
/* istanbul ignore if */
if (!ns.nested)
return [];
var unused = [];
for (var names = Object.keys(ns.nested), i = 0; i < names.length; ++i) {
var nested = ns.nested[names[i]];
if (nested instanceof protobuf.Type) {
var calls = (nested.encode.calls|0)
+ (nested.decode.calls|0)
+ (nested.verify.calls|0)
+ (nested.toObject.calls|0)
+ (nested.fromObject.calls|0);
if (!calls)
unused.push(nested);
} else if (nested instanceof protobuf.Namespace)
Array.prototype.push.apply(unused, unusedTypes(nested));
}
return unused;
};
/**
* Enables debugging extensions.
* @returns {undefined}
*/
debug.enable = function enable() {
protobuf.util.codegen = codegen_debug;
};
/**
* Disables debugging extensions.
* @returns {undefined}
*/
debug.disable = function disable() {
protobuf.util.codegen = codegen;
};

72
node_modules/protobufjs/ext/descriptor/README.md generated vendored Normal file
View File

@ -0,0 +1,72 @@
protobufjs/ext/descriptor
=========================
Experimental extension for interoperability with [descriptor.proto](https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto) types.
Usage
-----
```js
var protobuf = require("protobufjs"), // requires the full library
descriptor = require("protobufjs/ext/descriptor");
var root = ...;
// convert any existing root instance to the corresponding descriptor type
var descriptor = root.toDescriptor("proto2");
// ^ returns a FileDescriptorSet message, see table below
// encode to a descriptor buffer
var buffer = descriptor.FileDescriptorSet.encode(descriptor).finish();
// decode from a descriptor buffer
var decodedDescriptor = descriptor.FileDescriptorSet.decode(buffer);
// convert any existing descriptor to a root instance
root = protobuf.Root.fromDescriptor(decodedDescriptor);
// ^ expects a FileDescriptorSet message or buffer, see table below
// and start all over again
```
API
---
The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto:
| Descriptor type | protobuf.js type | Remarks
|-------------------------------|------------------|---------
| **FileDescriptorSet** | Root |
| FileDescriptorProto | | dependencies are not supported
| FileOptions | |
| FileOptionsOptimizeMode | |
| SourceCodeInfo | | not supported
| SourceCodeInfoLocation | |
| GeneratedCodeInfo | | not supported
| GeneratedCodeInfoAnnotation | |
| **DescriptorProto** | Type |
| MessageOptions | |
| DescriptorProtoExtensionRange | |
| DescriptorProtoReservedRange | |
| **FieldDescriptorProto** | Field |
| FieldDescriptorProtoLabel | |
| FieldDescriptorProtoType | |
| FieldOptions | |
| FieldOptionsCType | |
| FieldOptionsJSType | |
| **OneofDescriptorProto** | OneOf |
| OneofOptions | |
| **EnumDescriptorProto** | Enum |
| EnumOptions | |
| EnumValueDescriptorProto | |
| EnumValueOptions | | not supported
| **ServiceDescriptorProto** | Service |
| ServiceOptions | |
| **MethodDescriptorProto** | Method |
| MethodOptions | |
| UninterpretedOption | | not supported
| UninterpretedOptionNamePart | |
Note that not all features of descriptor.proto translate perfectly to a protobuf.js root instance. A root instance has only limited knowlege of packages or individual files for example, which is then compensated by guessing and generating fictional file names.
When using TypeScript, the respective interface types can be used to reference specific message instances (i.e. `protobuf.Message<IDescriptorProto>`).

191
node_modules/protobufjs/ext/descriptor/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,191 @@
import * as $protobuf from "../..";
export const FileDescriptorSet: $protobuf.Type;
export const FileDescriptorProto: $protobuf.Type;
export const DescriptorProto: $protobuf.Type & {
ExtensionRange: $protobuf.Type,
ReservedRange: $protobuf.Type
};
export const FieldDescriptorProto: $protobuf.Type & {
Label: $protobuf.Enum,
Type: $protobuf.Enum
};
export const OneofDescriptorProto: $protobuf.Type;
export const EnumDescriptorProto: $protobuf.Type;
export const ServiceDescriptorProto: $protobuf.Type;
export const EnumValueDescriptorProto: $protobuf.Type;
export const MethodDescriptorProto: $protobuf.Type;
export const FileOptions: $protobuf.Type & {
OptimizeMode: $protobuf.Enum
};
export const MessageOptions: $protobuf.Type;
export const FieldOptions: $protobuf.Type & {
CType: $protobuf.Enum,
JSType: $protobuf.Enum
};
export const OneofOptions: $protobuf.Type;
export const EnumOptions: $protobuf.Type;
export const EnumValueOptions: $protobuf.Type;
export const ServiceOptions: $protobuf.Type;
export const MethodOptions: $protobuf.Type;
export const UninterpretedOption: $protobuf.Type & {
NamePart: $protobuf.Type
};
export const SourceCodeInfo: $protobuf.Type & {
Location: $protobuf.Type
};
export const GeneratedCodeInfo: $protobuf.Type & {
Annotation: $protobuf.Type
};
export interface IFileDescriptorSet {
file: IFileDescriptorProto[];
}
export interface IFileDescriptorProto {
name?: string;
package?: string;
dependency?: any;
publicDependency?: any;
weakDependency?: any;
messageType?: IDescriptorProto[];
enumType?: IEnumDescriptorProto[];
service?: IServiceDescriptorProto[];
extension?: IFieldDescriptorProto[];
options?: IFileOptions;
sourceCodeInfo?: any;
syntax?: string;
}
export interface IFileOptions {
javaPackage?: string;
javaOuterClassname?: string;
javaMultipleFiles?: boolean;
javaGenerateEqualsAndHash?: boolean;
javaStringCheckUtf8?: boolean;
optimizeFor?: IFileOptionsOptimizeMode;
goPackage?: string;
ccGenericServices?: boolean;
javaGenericServices?: boolean;
pyGenericServices?: boolean;
deprecated?: boolean;
ccEnableArenas?: boolean;
objcClassPrefix?: string;
csharpNamespace?: string;
}
type IFileOptionsOptimizeMode = number;
export interface IDescriptorProto {
name?: string;
field?: IFieldDescriptorProto[];
extension?: IFieldDescriptorProto[];
nestedType?: IDescriptorProto[];
enumType?: IEnumDescriptorProto[];
extensionRange?: IDescriptorProtoExtensionRange[];
oneofDecl?: IOneofDescriptorProto[];
options?: IMessageOptions;
reservedRange?: IDescriptorProtoReservedRange[];
reservedName?: string[];
}
export interface IMessageOptions {
mapEntry?: boolean;
}
export interface IDescriptorProtoExtensionRange {
start?: number;
end?: number;
}
export interface IDescriptorProtoReservedRange {
start?: number;
end?: number;
}
export interface IFieldDescriptorProto {
name?: string;
number?: number;
label?: IFieldDescriptorProtoLabel;
type?: IFieldDescriptorProtoType;
typeName?: string;
extendee?: string;
defaultValue?: string;
oneofIndex?: number;
jsonName?: any;
options?: IFieldOptions;
}
type IFieldDescriptorProtoLabel = number;
type IFieldDescriptorProtoType = number;
export interface IFieldOptions {
packed?: boolean;
jstype?: IFieldOptionsJSType;
}
type IFieldOptionsJSType = number;
export interface IEnumDescriptorProto {
name?: string;
value?: IEnumValueDescriptorProto[];
options?: IEnumOptions;
}
export interface IEnumValueDescriptorProto {
name?: string;
number?: number;
options?: any;
}
export interface IEnumOptions {
allowAlias?: boolean;
deprecated?: boolean;
}
export interface IOneofDescriptorProto {
name?: string;
options?: any;
}
export interface IServiceDescriptorProto {
name?: string;
method?: IMethodDescriptorProto[];
options?: IServiceOptions;
}
export interface IServiceOptions {
deprecated?: boolean;
}
export interface IMethodDescriptorProto {
name?: string;
inputType?: string;
outputType?: string;
options?: IMethodOptions;
clientStreaming?: boolean;
serverStreaming?: boolean;
}
export interface IMethodOptions {
deprecated?: boolean;
}

1052
node_modules/protobufjs/ext/descriptor/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

54
node_modules/protobufjs/ext/descriptor/test.js generated vendored Normal file
View File

@ -0,0 +1,54 @@
/*eslint-disable no-console*/
"use strict";
var protobuf = require("../../"),
descriptor = require(".");
/* var proto = {
nested: {
Message: {
fields: {
foo: {
type: "string",
id: 1
}
},
nested: {
SubMessage: {
fields: {}
}
}
},
Enum: {
values: {
ONE: 1,
TWO: 2
}
}
}
}; */
// var root = protobuf.Root.fromJSON(proto).resolveAll();
var root = protobuf.loadSync("tests/data/google/protobuf/descriptor.proto").resolveAll();
// console.log("Original proto", JSON.stringify(root, null, 2));
var msg = root.toDescriptor();
// console.log("\nDescriptor", JSON.stringify(msg.toObject(), null, 2));
var buf = descriptor.FileDescriptorSet.encode(msg).finish();
var root2 = protobuf.Root.fromDescriptor(buf, "proto2").resolveAll();
// console.log("\nDecoded proto", JSON.stringify(root2, null, 2));
var diff = require("deep-diff").diff(root.toJSON(), root2.toJSON());
if (diff) {
diff.forEach(function(diff) {
console.log(diff.kind + " @ " + diff.path.join("."));
console.log("lhs:", typeof diff.lhs, diff.lhs);
console.log("rhs:", typeof diff.rhs, diff.rhs);
console.log();
});
process.exitCode = 1;
} else
console.log("no differences");