1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 04:26:00 +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

26
node_modules/@protobufjs/fetch/LICENSE generated vendored Normal file
View 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.

13
node_modules/@protobufjs/fetch/README.md generated vendored Normal file
View File

@ -0,0 +1,13 @@
@protobufjs/fetch
=================
[![npm](https://img.shields.io/npm/v/@protobufjs/fetch.svg)](https://www.npmjs.com/package/@protobufjs/fetch)
Fetches the contents of a file accross node and browsers.
API
---
* **fetch(path: `string`, [options: { binary: boolean } ], [callback: `function(error: ?Error, [contents: string])`]): `Promise<string|Uint8Array>|undefined`**
Fetches the contents of a file.
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)

56
node_modules/@protobufjs/fetch/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,56 @@
export = fetch;
/**
* Node-style callback as used by {@link util.fetch}.
* @typedef FetchCallback
* @type {function}
* @param {?Error} error Error, if any, otherwise `null`
* @param {string} [contents] File contents, if there hasn't been an error
* @returns {undefined}
*/
type FetchCallback = (error: Error, contents?: string) => void;
/**
* Options as used by {@link util.fetch}.
* @typedef FetchOptions
* @type {Object}
* @property {boolean} [binary=false] Whether expecting a binary response
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
*/
interface FetchOptions {
binary?: boolean;
xhr?: boolean
}
/**
* Fetches the contents of a file.
* @memberof util
* @param {string} filename File path or url
* @param {FetchOptions} options Fetch options
* @param {FetchCallback} callback Callback function
* @returns {undefined}
*/
declare function fetch(filename: string, options: FetchOptions, callback: FetchCallback): void;
/**
* Fetches the contents of a file.
* @name util.fetch
* @function
* @param {string} path File path or url
* @param {FetchCallback} callback Callback function
* @returns {undefined}
* @variation 2
*/
declare function fetch(path: string, callback: FetchCallback): void;
/**
* Fetches the contents of a file.
* @name util.fetch
* @function
* @param {string} path File path or url
* @param {FetchOptions} [options] Fetch options
* @returns {Promise<string|Uint8Array>} Promise
* @variation 3
*/
declare function fetch(path: string, options?: FetchOptions): Promise<(string|Uint8Array)>;

115
node_modules/@protobufjs/fetch/index.js generated vendored Normal file
View File

@ -0,0 +1,115 @@
"use strict";
module.exports = fetch;
var asPromise = require("@protobufjs/aspromise"),
inquire = require("@protobufjs/inquire");
var fs = inquire("fs");
/**
* Node-style callback as used by {@link util.fetch}.
* @typedef FetchCallback
* @type {function}
* @param {?Error} error Error, if any, otherwise `null`
* @param {string} [contents] File contents, if there hasn't been an error
* @returns {undefined}
*/
/**
* Options as used by {@link util.fetch}.
* @typedef FetchOptions
* @type {Object}
* @property {boolean} [binary=false] Whether expecting a binary response
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
*/
/**
* Fetches the contents of a file.
* @memberof util
* @param {string} filename File path or url
* @param {FetchOptions} options Fetch options
* @param {FetchCallback} callback Callback function
* @returns {undefined}
*/
function fetch(filename, options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
} else if (!options)
options = {};
if (!callback)
return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
if (!options.xhr && fs && fs.readFile)
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
return err && typeof XMLHttpRequest !== "undefined"
? fetch.xhr(filename, options, callback)
: err
? callback(err)
: callback(null, options.binary ? contents : contents.toString("utf8"));
});
// use the XHR version otherwise.
return fetch.xhr(filename, options, callback);
}
/**
* Fetches the contents of a file.
* @name util.fetch
* @function
* @param {string} path File path or url
* @param {FetchCallback} callback Callback function
* @returns {undefined}
* @variation 2
*/
/**
* Fetches the contents of a file.
* @name util.fetch
* @function
* @param {string} path File path or url
* @param {FetchOptions} [options] Fetch options
* @returns {Promise<string|Uint8Array>} Promise
* @variation 3
*/
/**/
fetch.xhr = function fetch_xhr(filename, options, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
if (xhr.readyState !== 4)
return undefined;
// local cors security errors return status 0 / empty string, too. afaik this cannot be
// reliably distinguished from an actually empty file for security reasons. feel free
// to send a pull request if you are aware of a solution.
if (xhr.status !== 0 && xhr.status !== 200)
return callback(Error("status " + xhr.status));
// if binary data is expected, make sure that some sort of array is returned, even if
// ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
if (options.binary) {
var buffer = xhr.response;
if (!buffer) {
buffer = [];
for (var i = 0; i < xhr.responseText.length; ++i)
buffer.push(xhr.responseText.charCodeAt(i) & 255);
}
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
}
return callback(null, xhr.responseText);
};
if (options.binary) {
// ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
if ("overrideMimeType" in xhr)
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.responseType = "arraybuffer";
}
xhr.open("GET", filename);
xhr.send();
};

61
node_modules/@protobufjs/fetch/package.json generated vendored Normal file
View File

@ -0,0 +1,61 @@
{
"_args": [
[
"@protobufjs/fetch@1.1.0",
"C:\\Users\\matia\\Musix"
]
],
"_from": "@protobufjs/fetch@1.1.0",
"_id": "@protobufjs/fetch@1.1.0",
"_inBundle": false,
"_integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=",
"_location": "/@protobufjs/fetch",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@protobufjs/fetch@1.1.0",
"name": "@protobufjs/fetch",
"escapedName": "@protobufjs%2ffetch",
"scope": "@protobufjs",
"rawSpec": "1.1.0",
"saveSpec": null,
"fetchSpec": "1.1.0"
},
"_requiredBy": [
"/protobufjs"
],
"_resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"_spec": "1.1.0",
"_where": "C:\\Users\\matia\\Musix",
"author": {
"name": "Daniel Wirtz",
"email": "dcode+protobufjs@dcode.io"
},
"bugs": {
"url": "https://github.com/dcodeIO/protobuf.js/issues"
},
"dependencies": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
},
"description": "Fetches the contents of a file accross node and browsers.",
"devDependencies": {
"istanbul": "^0.4.5",
"tape": "^4.6.3"
},
"homepage": "https://github.com/dcodeIO/protobuf.js#readme",
"license": "BSD-3-Clause",
"main": "index.js",
"name": "@protobufjs/fetch",
"repository": {
"type": "git",
"url": "git+https://github.com/dcodeIO/protobuf.js.git"
},
"scripts": {
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js",
"test": "tape tests/*.js"
},
"types": "index.d.ts",
"version": "1.1.0"
}

16
node_modules/@protobufjs/fetch/tests/index.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
var tape = require("tape");
var fetch = require("..");
tape.test("fetch", function(test) {
if (typeof Promise !== "undefined") {
var promise = fetch("NOTFOUND");
promise.catch(function() {});
test.ok(promise instanceof Promise, "should return a promise if callback has been omitted");
}
// TODO - some way to test this properly?
test.end();
});