mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-17 01:16:00 +00:00
Modules
This commit is contained in:
26
node_modules/@protobufjs/codegen/LICENSE
generated
vendored
Normal file
26
node_modules/@protobufjs/codegen/LICENSE
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of its author, nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
49
node_modules/@protobufjs/codegen/README.md
generated
vendored
Normal file
49
node_modules/@protobufjs/codegen/README.md
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
@protobufjs/codegen
|
||||
===================
|
||||
[](https://www.npmjs.com/package/@protobufjs/codegen)
|
||||
|
||||
A minimalistic code generation utility.
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
* **codegen([functionParams: `string[]`], [functionName: string]): `Codegen`**<br />
|
||||
Begins generating a function.
|
||||
|
||||
* **codegen.verbose = `false`**<br />
|
||||
When set to true, codegen will log generated code to console. Useful for debugging.
|
||||
|
||||
Invoking **codegen** returns an appender function that appends code to the function's body and returns itself:
|
||||
|
||||
* **Codegen(formatString: `string`, [...formatParams: `any`]): Codegen**<br />
|
||||
Appends code to the function's body. The format string can contain placeholders specifying the types of inserted format parameters:
|
||||
|
||||
* `%d`: Number (integer or floating point value)
|
||||
* `%f`: Floating point value
|
||||
* `%i`: Integer value
|
||||
* `%j`: JSON.stringify'ed value
|
||||
* `%s`: String value
|
||||
* `%%`: Percent sign<br />
|
||||
|
||||
* **Codegen([scope: `Object.<string,*>`]): `Function`**<br />
|
||||
Finishes the function and returns it.
|
||||
|
||||
* **Codegen.toString([functionNameOverride: `string`]): `string`**<br />
|
||||
Returns the function as a string.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
```js
|
||||
var codegen = require("@protobufjs/codegen");
|
||||
|
||||
var add = codegen(["a", "b"], "add") // A function with parameters "a" and "b" named "add"
|
||||
("// awesome comment") // adds the line to the function's body
|
||||
("return a + b - c + %d", 1) // replaces %d with 1 and adds the line to the body
|
||||
({ c: 1 }); // adds "c" with a value of 1 to the function's scope
|
||||
|
||||
console.log(add.toString()); // function add(a, b) { return a + b - c + 1 }
|
||||
console.log(add(1, 2)); // calculates 1 + 2 - 1 + 1 = 3
|
||||
```
|
||||
|
||||
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
31
node_modules/@protobufjs/codegen/index.d.ts
generated
vendored
Normal file
31
node_modules/@protobufjs/codegen/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
export = codegen;
|
||||
|
||||
/**
|
||||
* Appends code to the function's body.
|
||||
* @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
||||
* @param [formatParams] Format parameters
|
||||
* @returns Itself or the generated function if finished
|
||||
* @throws {Error} If format parameter counts do not match
|
||||
*/
|
||||
type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function);
|
||||
|
||||
/**
|
||||
* Begins generating a function.
|
||||
* @param functionParams Function parameter names
|
||||
* @param [functionName] Function name if not anonymous
|
||||
* @returns Appender that appends code to the function's body
|
||||
*/
|
||||
declare function codegen(functionParams: string[], functionName?: string): Codegen;
|
||||
|
||||
/**
|
||||
* Begins generating a function.
|
||||
* @param [functionName] Function name if not anonymous
|
||||
* @returns Appender that appends code to the function's body
|
||||
*/
|
||||
declare function codegen(functionName?: string): Codegen;
|
||||
|
||||
declare namespace codegen {
|
||||
|
||||
/** When set to `true`, codegen will log generated code to console. Useful for debugging. */
|
||||
let verbose: boolean;
|
||||
}
|
99
node_modules/@protobufjs/codegen/index.js
generated
vendored
Normal file
99
node_modules/@protobufjs/codegen/index.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
module.exports = codegen;
|
||||
|
||||
/**
|
||||
* Begins generating a function.
|
||||
* @memberof util
|
||||
* @param {string[]} functionParams Function parameter names
|
||||
* @param {string} [functionName] Function name if not anonymous
|
||||
* @returns {Codegen} Appender that appends code to the function's body
|
||||
*/
|
||||
function codegen(functionParams, functionName) {
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (typeof functionParams === "string") {
|
||||
functionName = functionParams;
|
||||
functionParams = undefined;
|
||||
}
|
||||
|
||||
var body = [];
|
||||
|
||||
/**
|
||||
* Appends code to the function's body or finishes generation.
|
||||
* @typedef Codegen
|
||||
* @type {function}
|
||||
* @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
||||
* @param {...*} [formatParams] Format parameters
|
||||
* @returns {Codegen|Function} Itself or the generated function if finished
|
||||
* @throws {Error} If format parameter counts do not match
|
||||
*/
|
||||
|
||||
function Codegen(formatStringOrScope) {
|
||||
// note that explicit array handling below makes this ~50% faster
|
||||
|
||||
// finish the function
|
||||
if (typeof formatStringOrScope !== "string") {
|
||||
var source = toString();
|
||||
if (codegen.verbose)
|
||||
console.log("codegen: " + source); // eslint-disable-line no-console
|
||||
source = "return " + source;
|
||||
if (formatStringOrScope) {
|
||||
var scopeKeys = Object.keys(formatStringOrScope),
|
||||
scopeParams = new Array(scopeKeys.length + 1),
|
||||
scopeValues = new Array(scopeKeys.length),
|
||||
scopeOffset = 0;
|
||||
while (scopeOffset < scopeKeys.length) {
|
||||
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
||||
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
||||
}
|
||||
scopeParams[scopeOffset] = source;
|
||||
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
||||
}
|
||||
return Function(source)(); // eslint-disable-line no-new-func
|
||||
}
|
||||
|
||||
// otherwise append to body
|
||||
var formatParams = new Array(arguments.length - 1),
|
||||
formatOffset = 0;
|
||||
while (formatOffset < formatParams.length)
|
||||
formatParams[formatOffset] = arguments[++formatOffset];
|
||||
formatOffset = 0;
|
||||
formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
|
||||
var value = formatParams[formatOffset++];
|
||||
switch ($1) {
|
||||
case "d": case "f": return String(Number(value));
|
||||
case "i": return String(Math.floor(value));
|
||||
case "j": return JSON.stringify(value);
|
||||
case "s": return String(value);
|
||||
}
|
||||
return "%";
|
||||
});
|
||||
if (formatOffset !== formatParams.length)
|
||||
throw Error("parameter count mismatch");
|
||||
body.push(formatStringOrScope);
|
||||
return Codegen;
|
||||
}
|
||||
|
||||
function toString(functionNameOverride) {
|
||||
return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
|
||||
}
|
||||
|
||||
Codegen.toString = toString;
|
||||
return Codegen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins generating a function.
|
||||
* @memberof util
|
||||
* @function codegen
|
||||
* @param {string} [functionName] Function name if not anonymous
|
||||
* @returns {Codegen} Appender that appends code to the function's body
|
||||
* @variation 2
|
||||
*/
|
||||
|
||||
/**
|
||||
* When set to `true`, codegen will log generated code to console. Useful for debugging.
|
||||
* @name util.codegen.verbose
|
||||
* @type {boolean}
|
||||
*/
|
||||
codegen.verbose = false;
|
49
node_modules/@protobufjs/codegen/package.json
generated
vendored
Normal file
49
node_modules/@protobufjs/codegen/package.json
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@protobufjs/codegen@2.0.4",
|
||||
"C:\\Users\\matia\\Musix"
|
||||
]
|
||||
],
|
||||
"_from": "@protobufjs/codegen@2.0.4",
|
||||
"_id": "@protobufjs/codegen@2.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
|
||||
"_location": "/@protobufjs/codegen",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@protobufjs/codegen@2.0.4",
|
||||
"name": "@protobufjs/codegen",
|
||||
"escapedName": "@protobufjs%2fcodegen",
|
||||
"scope": "@protobufjs",
|
||||
"rawSpec": "2.0.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.0.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/protobufjs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
|
||||
"_spec": "2.0.4",
|
||||
"_where": "C:\\Users\\matia\\Musix",
|
||||
"author": {
|
||||
"name": "Daniel Wirtz",
|
||||
"email": "dcode+protobufjs@dcode.io"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dcodeIO/protobuf.js/issues"
|
||||
},
|
||||
"description": "A minimalistic code generation utility.",
|
||||
"homepage": "https://github.com/dcodeIO/protobuf.js#readme",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"name": "@protobufjs/codegen",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dcodeIO/protobuf.js.git"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "2.0.4"
|
||||
}
|
13
node_modules/@protobufjs/codegen/tests/index.js
generated
vendored
Normal file
13
node_modules/@protobufjs/codegen/tests/index.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
var codegen = require("..");
|
||||
|
||||
// new require("benchmark").Suite().add("add", function() {
|
||||
|
||||
var add = codegen(["a", "b"], "add")
|
||||
("// awesome comment")
|
||||
("return a + b - c + %d", 1)
|
||||
({ c: 1 });
|
||||
|
||||
if (add(1, 2) !== 3)
|
||||
throw Error("failed");
|
||||
|
||||
// }).on("cycle", function(event) { process.stdout.write(String(event.target) + "\n"); }).run();
|
Reference in New Issue
Block a user