diff --git a/node_modules/@actions/core/README.md b/node_modules/@actions/core/README.md new file mode 100644 index 000000000..5ad27eede --- /dev/null +++ b/node_modules/@actions/core/README.md @@ -0,0 +1,146 @@ +# `@actions/core` + +> Core functions for setting results, logging, registering secrets and exporting variables across actions + +## Usage + +### Import the package + +```js +// javascript +const core = require('@actions/core'); + +// typescript +import * as core from '@actions/core'; +``` + +#### Inputs/Outputs + +Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled. + +```js +const myInput = core.getInput('inputName', { required: true }); + +core.setOutput('outputKey', 'outputVal'); +``` + +#### Exporting variables + +Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks. + +```js +core.exportVariable('envVar', 'Val'); +``` + +#### Setting a secret + +Setting a secret registers the secret with the runner to ensure it is masked in logs. + +```js +core.setSecret('myPassword'); +``` + +#### PATH Manipulation + +To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH. + +```js +core.addPath('/path/to/mytool'); +``` + +#### Exit codes + +You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success. + +```js +const core = require('@actions/core'); + +try { + // Do stuff +} +catch (err) { + // setFailed logs the message and sets a failing exit code + core.setFailed(`Action failed with error ${err}`); +} + +Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned. + +``` + +#### Logging + +Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs). + +```js +const core = require('@actions/core'); + +const myInput = core.getInput('input'); +try { + core.debug('Inside try block'); + + if (!myInput) { + core.warning('myInput was not set'); + } + + if (core.isDebug()) { + // curl -v https://github.com + } else { + // curl https://github.com + } + + // Do stuff +} +catch (err) { + core.error(`Error ${err}, action may still succeed though`); +} +``` + +This library can also wrap chunks of output in foldable groups. + +```js +const core = require('@actions/core') + +// Manually wrap output +core.startGroup('Do some function') +doSomeFunction() +core.endGroup() + +// Wrap an asynchronous function call +const result = await core.group('Do something async', async () => { + const response = await doSomeHTTPRequest() + return response +}) +``` + +#### Action state + +You can use this library to save state and get state for sharing information between a given wrapper action: + +**action.yml** +```yaml +name: 'Wrapper action sample' +inputs: + name: + default: 'GitHub' +runs: + using: 'node12' + main: 'main.js' + post: 'cleanup.js' +``` + +In action's `main.js`: + +```js +const core = require('@actions/core'); + +core.saveState("pidToKill", 12345); +``` + +In action's `cleanup.js`: +```js +const core = require('@actions/core'); + +var pid = core.getState("pidToKill"); + +process.kill(pid); +``` \ No newline at end of file diff --git a/node_modules/@actions/core/lib/command.d.ts b/node_modules/@actions/core/lib/command.d.ts new file mode 100644 index 000000000..51b8f116d --- /dev/null +++ b/node_modules/@actions/core/lib/command.d.ts @@ -0,0 +1,16 @@ +interface CommandProperties { + [key: string]: string; +} +/** + * Commands + * + * Command Format: + * ::name key=value,key=value::message + * + * Examples: + * ::warning::This is the message + * ::set-env name=MY_VAR::some value + */ +export declare function issueCommand(command: string, properties: CommandProperties, message: string): void; +export declare function issue(name: string, message?: string): void; +export {}; diff --git a/node_modules/@actions/core/lib/command.js b/node_modules/@actions/core/lib/command.js new file mode 100644 index 000000000..eeef233ee --- /dev/null +++ b/node_modules/@actions/core/lib/command.js @@ -0,0 +1,78 @@ +"use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const os = __importStar(require("os")); +/** + * Commands + * + * Command Format: + * ::name key=value,key=value::message + * + * Examples: + * ::warning::This is the message + * ::set-env name=MY_VAR::some value + */ +function issueCommand(command, properties, message) { + const cmd = new Command(command, properties, message); + process.stdout.write(cmd.toString() + os.EOL); +} +exports.issueCommand = issueCommand; +function issue(name, message = '') { + issueCommand(name, {}, message); +} +exports.issue = issue; +const CMD_STRING = '::'; +class Command { + constructor(command, properties, message) { + if (!command) { + command = 'missing.command'; + } + this.command = command; + this.properties = properties; + this.message = message; + } + toString() { + let cmdStr = CMD_STRING + this.command; + if (this.properties && Object.keys(this.properties).length > 0) { + cmdStr += ' '; + let first = true; + for (const key in this.properties) { + if (this.properties.hasOwnProperty(key)) { + const val = this.properties[key]; + if (val) { + if (first) { + first = false; + } + else { + cmdStr += ','; + } + cmdStr += `${key}=${escapeProperty(val)}`; + } + } + } + } + cmdStr += `${CMD_STRING}${escapeData(this.message)}`; + return cmdStr; + } +} +function escapeData(s) { + return (s || '') + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A'); +} +function escapeProperty(s) { + return (s || '') + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A') + .replace(/:/g, '%3A') + .replace(/,/g, '%2C'); +} +//# sourceMappingURL=command.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/command.js.map b/node_modules/@actions/core/lib/command.js.map new file mode 100644 index 000000000..00a9861e6 --- /dev/null +++ b/node_modules/@actions/core/lib/command.js.map @@ -0,0 +1 @@ +{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/core.d.ts b/node_modules/@actions/core/lib/core.d.ts new file mode 100644 index 000000000..8fcc31bae --- /dev/null +++ b/node_modules/@actions/core/lib/core.d.ts @@ -0,0 +1,116 @@ +/** + * Interface for getInput options + */ +export interface InputOptions { + /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */ + required?: boolean; +} +/** + * The code to exit an action + */ +export declare enum ExitCode { + /** + * A code indicating that the action was successful + */ + Success = 0, + /** + * A code indicating that the action was a failure + */ + Failure = 1 +} +/** + * Sets env variable for this action and future actions in the job + * @param name the name of the variable to set + * @param val the value of the variable + */ +export declare function exportVariable(name: string, val: string): void; +/** + * Registers a secret which will get masked from logs + * @param secret value of the secret + */ +export declare function setSecret(secret: string): void; +/** + * Prepends inputPath to the PATH (for this action and future actions) + * @param inputPath + */ +export declare function addPath(inputPath: string): void; +/** + * Gets the value of an input. The value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string + */ +export declare function getInput(name: string, options?: InputOptions): string; +/** + * Sets the value of an output. + * + * @param name name of the output to set + * @param value value to store + */ +export declare function setOutput(name: string, value: string): void; +/** + * Sets the action status to failed. + * When the action exits it will be with an exit code of 1 + * @param message add error issue message + */ +export declare function setFailed(message: string): void; +/** + * Gets whether Actions Step Debug is on or not + */ +export declare function isDebug(): boolean; +/** + * Writes debug message to user log + * @param message debug message + */ +export declare function debug(message: string): void; +/** + * Adds an error issue + * @param message error issue message + */ +export declare function error(message: string): void; +/** + * Adds an warning issue + * @param message warning issue message + */ +export declare function warning(message: string): void; +/** + * Writes info to log with console.log. + * @param message info message + */ +export declare function info(message: string): void; +/** + * Begin an output group. + * + * Output until the next `groupEnd` will be foldable in this group + * + * @param name The name of the output group + */ +export declare function startGroup(name: string): void; +/** + * End an output group. + */ +export declare function endGroup(): void; +/** + * Wrap an asynchronous function call in a group. + * + * Returns the same type as the function itself. + * + * @param name The name of the group + * @param fn The function to wrap in the group + */ +export declare function group(name: string, fn: () => Promise): Promise; +/** + * Saves state for current action, the state can only be retrieved by this action's post job execution. + * + * @param name name of the state to store + * @param value value to store + */ +export declare function saveState(name: string, value: string): void; +/** + * Gets the value of an state set by this action's main execution. + * + * @param name name of the state to get + * @returns string + */ +export declare function getState(name: string): string; diff --git a/node_modules/@actions/core/lib/core.js b/node_modules/@actions/core/lib/core.js new file mode 100644 index 000000000..b7ec8ab45 --- /dev/null +++ b/node_modules/@actions/core/lib/core.js @@ -0,0 +1,209 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const command_1 = require("./command"); +const os = __importStar(require("os")); +const path = __importStar(require("path")); +/** + * The code to exit an action + */ +var ExitCode; +(function (ExitCode) { + /** + * A code indicating that the action was successful + */ + ExitCode[ExitCode["Success"] = 0] = "Success"; + /** + * A code indicating that the action was a failure + */ + ExitCode[ExitCode["Failure"] = 1] = "Failure"; +})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); +//----------------------------------------------------------------------- +// Variables +//----------------------------------------------------------------------- +/** + * Sets env variable for this action and future actions in the job + * @param name the name of the variable to set + * @param val the value of the variable + */ +function exportVariable(name, val) { + process.env[name] = val; + command_1.issueCommand('set-env', { name }, val); +} +exports.exportVariable = exportVariable; +/** + * Registers a secret which will get masked from logs + * @param secret value of the secret + */ +function setSecret(secret) { + command_1.issueCommand('add-mask', {}, secret); +} +exports.setSecret = setSecret; +/** + * Prepends inputPath to the PATH (for this action and future actions) + * @param inputPath + */ +function addPath(inputPath) { + command_1.issueCommand('add-path', {}, inputPath); + process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; +} +exports.addPath = addPath; +/** + * Gets the value of an input. The value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string + */ +function getInput(name, options) { + const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; + if (options && options.required && !val) { + throw new Error(`Input required and not supplied: ${name}`); + } + return val.trim(); +} +exports.getInput = getInput; +/** + * Sets the value of an output. + * + * @param name name of the output to set + * @param value value to store + */ +function setOutput(name, value) { + command_1.issueCommand('set-output', { name }, value); +} +exports.setOutput = setOutput; +//----------------------------------------------------------------------- +// Results +//----------------------------------------------------------------------- +/** + * Sets the action status to failed. + * When the action exits it will be with an exit code of 1 + * @param message add error issue message + */ +function setFailed(message) { + process.exitCode = ExitCode.Failure; + error(message); +} +exports.setFailed = setFailed; +//----------------------------------------------------------------------- +// Logging Commands +//----------------------------------------------------------------------- +/** + * Gets whether Actions Step Debug is on or not + */ +function isDebug() { + return process.env['RUNNER_DEBUG'] === '1'; +} +exports.isDebug = isDebug; +/** + * Writes debug message to user log + * @param message debug message + */ +function debug(message) { + command_1.issueCommand('debug', {}, message); +} +exports.debug = debug; +/** + * Adds an error issue + * @param message error issue message + */ +function error(message) { + command_1.issue('error', message); +} +exports.error = error; +/** + * Adds an warning issue + * @param message warning issue message + */ +function warning(message) { + command_1.issue('warning', message); +} +exports.warning = warning; +/** + * Writes info to log with console.log. + * @param message info message + */ +function info(message) { + process.stdout.write(message + os.EOL); +} +exports.info = info; +/** + * Begin an output group. + * + * Output until the next `groupEnd` will be foldable in this group + * + * @param name The name of the output group + */ +function startGroup(name) { + command_1.issue('group', name); +} +exports.startGroup = startGroup; +/** + * End an output group. + */ +function endGroup() { + command_1.issue('endgroup'); +} +exports.endGroup = endGroup; +/** + * Wrap an asynchronous function call in a group. + * + * Returns the same type as the function itself. + * + * @param name The name of the group + * @param fn The function to wrap in the group + */ +function group(name, fn) { + return __awaiter(this, void 0, void 0, function* () { + startGroup(name); + let result; + try { + result = yield fn(); + } + finally { + endGroup(); + } + return result; + }); +} +exports.group = group; +//----------------------------------------------------------------------- +// Wrapper action state +//----------------------------------------------------------------------- +/** + * Saves state for current action, the state can only be retrieved by this action's post job execution. + * + * @param name name of the state to store + * @param value value to store + */ +function saveState(name, value) { + command_1.issueCommand('save-state', { name }, value); +} +exports.saveState = saveState; +/** + * Gets the value of an state set by this action's main execution. + * + * @param name name of the state to get + * @returns string + */ +function getState(name) { + return process.env[`STATE_${name}`] || ''; +} +exports.getState = getState; +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/core.js.map b/node_modules/@actions/core/lib/core.js.map new file mode 100644 index 000000000..fb93bd383 --- /dev/null +++ b/node_modules/@actions/core/lib/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAE7C,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"} \ No newline at end of file diff --git a/node_modules/@actions/core/package.json b/node_modules/@actions/core/package.json new file mode 100644 index 000000000..af6022bd9 --- /dev/null +++ b/node_modules/@actions/core/package.json @@ -0,0 +1,67 @@ +{ + "_from": "@actions/core", + "_id": "@actions/core@1.2.3", + "_inBundle": false, + "_integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w==", + "_location": "/@actions/core", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "@actions/core", + "name": "@actions/core", + "escapedName": "@actions%2fcore", + "scope": "@actions", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz", + "_shasum": "e844b4fa0820e206075445079130868f95bfca95", + "_spec": "@actions/core", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge", + "bugs": { + "url": "https://github.com/actions/toolkit/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Actions core lib", + "devDependencies": { + "@types/node": "^12.0.2" + }, + "directories": { + "lib": "lib", + "test": "__tests__" + }, + "files": [ + "lib" + ], + "homepage": "https://github.com/actions/toolkit/tree/master/packages/core", + "keywords": [ + "github", + "actions", + "core" + ], + "license": "MIT", + "main": "lib/core.js", + "name": "@actions/core", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/actions/toolkit.git", + "directory": "packages/core" + }, + "scripts": { + "audit-moderate": "npm install && npm audit --audit-level=moderate", + "test": "echo \"Error: run tests from root\" && exit 1", + "tsc": "tsc" + }, + "types": "lib/core.d.ts", + "version": "1.2.3" +} diff --git a/node_modules/badgen/README.md b/node_modules/badgen/README.md index 20bebc08a..852eea304 100644 --- a/node_modules/badgen/README.md +++ b/node_modules/badgen/README.md @@ -20,14 +20,14 @@ const { badgen } = require('badgen') // only `status` is required. const svgString = badgen({ - label: 'npm', // - labelColor: 'ADF', // or (default: '555') - status: 'v1.2.3', // , required - color: 'blue', // or (default: 'blue') - style: 'flat', // 'flat' or 'classic' (default: 'classic') + label: 'npm', // + labelColor: 'ADF' // or (default: '555') + status: 'v1.2.3', // , required + color: 'blue', // or (default: 'blue') + style: 'flat', // 'flat' or 'classic' (default: 'classic') icon: 'data:image/svg+xml;base64,...', // Use icon (default: undefined) - iconWidth: 13, // Set this if icon is not square (default: 13) - scale: 1 // Set badge scale (default: 1) + iconWidth: 13, // Set this if icon is not square (default: 13) + scale: 1 // Set badge scale (default: 1) }) ``` @@ -47,9 +47,9 @@ Available color names: ### In browser ```html - + ``` diff --git a/node_modules/badgen/dist/color-presets.d.ts b/node_modules/badgen/dist/color-presets.d.ts index 4d8dbbe94..99e17d67e 100644 --- a/node_modules/badgen/dist/color-presets.d.ts +++ b/node_modules/badgen/dist/color-presets.d.ts @@ -1,2 +1,14 @@ -declare const _default: Record; +declare const _default: { + green: string; + blue: string; + red: string; + yellow: string; + orange: string; + purple: string; + pink: string; + grey: string; + gray: string; + cyan: string; + black: string; +}; export default _default; diff --git a/node_modules/badgen/dist/index.browser.js b/node_modules/badgen/dist/index.browser.js deleted file mode 100644 index 75717344a..000000000 --- a/node_modules/badgen/dist/index.browser.js +++ /dev/null @@ -1,58 +0,0 @@ -(()=>{var E=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var L=E((j,B)=>{B.exports=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,43,50,90,70,120,80,30,50,50,70,90,40,50,40,50,70,70,70,70,70,70,70,70,70,70,50,50,90,90,90,60,110,75,75,77,85,70,63,85,83,46,50,76,61,93,82,87,66,87,76,75,68,81,75,110,75,68,75,50,50,50,90,70,70,66,69,57,69,66,39,69,70,30,38,65,30,110,70,67,69,69,47,57,43,70,65,90,65,65,58,70,50,70,90,0,61,110,110,110,110,110,110,110,110,110,110,110,110,110,55,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,55,110,39,43,70,70,70,70,50,70,70,110,60,71,90,0,110,70,60,90,60,60,70,71,70,40,70,60,60,71,110,110,110,60,75,75,75,75,75,75,110,77,70,70,70,70,46,46,46,46,85,82,87,87,87,87,87,90,87,81,81,81,81,68,67,68,66,66,66,66,66,66,110,57,66,66,66,66,30,30,30,30,67,70,67,67,67,67,67,90,67,70,70,70,70,65,69,65,75,66,75,66,75,66,77,57,77,57,77,57,77,57,85,71,85,69,70,66,70,66,70,66,70,66,70,66,85,69,85,69,85,69,85,69,83,70,83,70,46,30,46,30,46,30,46,30,46,30,96,68,50,38,76,65,65,61,30,61,30,61,33,61,50,62,31,82,70,82,70,82,70,80,82,70,87,67,87,67,87,67,120,110,76,47,76,47,76,47,75,57,75,57,75,57,75,57,68,43,68,43,68,43,81,70,81,70,81,69,81,70,81,70,81,69,110,90,68,65,68,75,58,75,58,75,58,33,69,77,64,69,75,62,76,76,59,83,96,64,69,65,60,83,58,59,70,79,72,100,43,43,73,64,42,65,120,81,68,86,89,67,120,98,74,69,70,59,56,65,58,41,74,41,70,83,73,86,78,68,74,67,63,61,61,56,57,70,70,52,50,67,29,48,50,32,140,140,130,94,90,61,110,110,99,76,61,32,32,85,68,76,68,76,68,81,70,76,68,81,70,61,76,61,76,61,100,94,88,69,79,69,72,64,85,68,85,68,61,56,28,140,140,130,85,69,110,61,82,70,75,66,110,110,87,67,72,60,76,61,63,58,60,61,30,27,32,32,76,63,85,68,68,37,70,45,71,61,76,68,75,57,68,43,58,55,81,68,81,100,85,68,67,63,76,61,60,61,85,68,85,68,85,68,85,68,69,57,63,100,63,28,100,100,75,81,56,62,68,55,55,62,62,81,95,75,75,62,61,25,96,69,87,44,86,69,61,69,69,69,56,61,70,70,61,66,86,51,51,71,64,45,70,69,65,59,65,68,68,68,42,41,45,56,53,33,72,100,100,100,69,70,69,68,89,86,84,45,45,47,45,45,45,45,61,61,56,47,48,53,59,41,41,72,73,68,57,85,57,53,63,77,56,59,49,49,49,53,85,58,65,67,69,53,64,51,70,50,49,110,110,130,88,78,96,110,74,77,68,64,71,71,40,40,26,27,27,35,35,51,36,26,52,35,22,28,29,29,31,31,38,39,40,40,70,70,20,70,31,31,20,40,31,31,42,42,31,31,50,50,50,50,70,70,70,70,70,70,23,38,41,20,35,40,31,43,43,43,43,43,42,42,37,46,48,24,24,26,26,32,31,47,47,41,27,31,31,31,31,42,42,50,0,0,53,0,51,68,52,39,49,0,46,51,53,38,47,0,52,52,39,39,39,11,46,47,44,44,26,17,41,48,48,48,48,25,25,0,49,46,21,40,41,38,40,57,53,53,52,52,52,51,68,68,62,62,68,62,79,41,0,40,57,48,41,68,0,0,52,42,53,38,40,51,47,45,52,52,52,57,44,0,45,41,52,48,45,45,56,41,20,48,51,47,83,52,51,51,51,51,51,45,44,36,45,44,44,45,44,51,40,41,45,45,46,37,65,51,32,32,79,64,79,79,68,56,56,56,50,66,79,79,79,79,70,70,75,50,83,96,59,79,97,79,83,100,30,75,75,62,77,70,75,83,87,46,76,75,93,82,71,87,83,66,79,74,68,68,90,75,96,90,46,68,69,56,70,30,69,69,68,65,67,56,50,70,69,30,65,65,70,65,55,67,70,69,56,69,55,69,87,65,90,89,30,69,67,69,89,62,57,64,59,59,70,85,86,61,85,68,73,59,59,56,60,56,73,88,98,92,74,61,74,55,73,73,67,66,81,61,51,45,61,67,56,33,86,58,58,63,67,76,95,80,78,81,81,81,70,70,87,62,77,75,46,46,50,120,120,90,76,83,68,83,75,75,75,62,82,70,110,68,83,83,76,81,93,83,87,83,66,77,68,68,90,75,84,78,110,110,86,100,75,77,110,78,66,68,65,52,68,66,88,58,70,70,65,68,77,70,67,70,69,59,55,65,92,65,71,67,96,98,70,87,63,60,92,66,66,66,70,52,60,57,30,30,38,100,100,70,65,70,65,70,97,85,69,60,99,82,66,59,97,83,94,81,120,110,57,53,76,77,75,63,69,55,69,55,130,110,75,62,96,84,97,85,71,59,69,0,0,0,0,0,0,0,78,63,69,60,70,62,62,52,62,52,67,55,110,88,65,56,76,65,76,65,72,57,90,76,83,70,110,78,110,96,82,66,72,58,66,53,68,65,68,65,75,65,99,74,75,60,78,67,78,70,85,65,85,65,30,100,84,69,60,78,64,78,62,78,63,75,60,96,82,30,72,60,72,60,100,93,63,58,83,66,76,58,100,84,65,56,64,64,78,63,78,63,76,63,87,67,75,63,74,59,69,52,69,52,69,52,75,60,61,46,95,85,65,45,69,55,69,55,68,62,90,95,87,71,59,55,110,89,110,91,68,57,78,70,74,59,78,64,84,76,91,75,110,81,85,68,100,87,75,69,110,88,120,100,76,66,74,68,49,44,98,89,62,58,73,65,79,84,63,81,81,68,71,63,60,80,75,64,57,80,72,66,65,77,79,68,80,61,81,70,59,66,73,67,81,68,81,61,54,63,69,75,69,64,77,79,79,44,37,33,42,29,38,0,79,82,56,67,70,55,58,52,56,63,63,55,30,84,58,54,55,51,57,58,58,30,56,48,58,45,81,48,67,58,58,83,70,56,43,81,65,55,69,59,79,39,44,79,79,79,79,88,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,3.3,15,0,0,0,38,0,28,0,0,28,0,5,44,12,79,79,79,79,79,79,79,79,71,62,47,55,78,35,37,78,71,35,58,63,59,77,76,34,45,73,66,58,63,53,63,73,56,79,76,79,79,79,79,79,68,68,66,31,53,79,79,79,79,79,79,79,79,79,79,79,97,190,93,81,290,120,71,71,86,58,58,53,32,49,93,58,0,0,.9,0,0,0,0,0,0,0,9,32,0,79,27,39,89,35,32,32,43,32,70,32,70,39,70,70,64,64,64,45,45,45,45,100,100,120,120,66,66,64,64,77,77,70,70,70,22,86,60,60,52,45,59,39,43,70,70,0,.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,58,58,58,58,58,58,58,58,58,58,58,58,57,70,60,0,32,32,32,0,47,58,54,70,70,70,70,70,70,70,70,70,64,64,64,64,64,64,64,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,100,100,100,120,120,66,64,86,86,86,86,86,86,60,60,77,77,77,60,60,60,77,77,77,77,77,77,52,52,52,52,59,59,59,59,59,57,64,39,49,49,49,43,43,43,43,43,43,43,43,70,79,70,43,70,70,64,64,35,39,7,4.1,.45,.099,0,0,0,95,61,0,0,0,0,24,0,25,38,0,0,70,0,0,0,0,45,45,51,51,58,58,58,58,58,58,58,58,100,120,64,51,48,57,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,70,70,70,70,70,70,70,64,64,45,45,45,100,64,64,64,86,86,77,77,77,45,45,59,59,59,52,45,45,100,64,64,100,45,64,32,32,70,70,70,43,43,64,64,64,100,100,60,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,96,96,74,84,100,74,70,54,83,83,61,47,64,26,52,120,92,52,37,73,88,79,96,96,96,38,83,100,74,66,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,58,40,41,34,33,79,79,79,79,79,79,56,62,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,0,0,0,0,0,73,73,73,100,80,80,110,58,58,52,74,91,79,60,60,60,60,110,110,110,110,85,87,61,70,68,71,75,82,85,77,55,63,60,58,83,61,71,58,70,56,56,62,87,62,64,64,67,44,45,78,81,81,60,79,63,75,56,73,100,73,54,100,100,100,73,73,73,73,73,73,73,73,100,100,100,100,73,100,100,130,0,0,73,73,73,73,73,85,87,61,82,60,58,87,67,91,79,73,73,52,82,51,53,54,54,56,59,58,72,53,52,55,34,80,80,110,110,80,80,57,82,67,61,80,50,61,62,62,73,120,120,79,98,130,54,72,73,75,83,68,79,79,78,83,79,79,66,78,76,72,70,69,76,58,65,88,85,100,60,60,73,60,67,75,74,60,67,69,79,72,83,60,79,64,62,60,79,81,79,79,79,77,62,72,54,79,79,73,51,100,100,100,73,73,73,73,79,79,100,100,79,79,130,130,73,57,79,79,79,79,79,79,79,79,100,79,79,79,79,73,60,79,62,83,68,73,73,79,79,65,58,53,80,55,67,70,62,76,69,61,60,46,66,44,75,70,30,62,58,70,30,79,79,79,79,79,34,23,32,79,89,110,97,98,78,78,79,79,79,79,73,89,79,79,78,89,76,76,90,92,75,76,79,76,79,73,73,79,75,76,78,75,76,76,76,79,79,76,75,77,75,75,91,73,79,78,78,79,76,75,79,75,73,79,79,12,79,26,23,50,64,64,79,79,79,79,62,62,79,79,67,58,19,79,79,79,19,79,79,79,79,79,79,79,76,90,76,75,79,75,79,79,79,79,79,79,79,93,68,69,70,77,76,70,70,80,77,36,26,73,78,170,46,79,79,79,79,79,79,79,79,79,79,79,89,89,28,79,94,120,71,78,82,95,88,83,94,79,94,94,120,79,120,120,63,84,79,70,65,74,86,92,92,76,70,79,63,76,98,71,74,63,71,73,79,74,63,85,89,67,74,56,79,74,90,79,74,79,74,81,65,79,79,89,56,120,100,120,89,89,89,89,89,79,89,89,120,79,120,120,89,79,79,120,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,95,83,89,89,79,79,74,46,56,62,72,74,57,85,59,75,47,100,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,28,46,48,79,84,100,88,90,91,90,90,62,79,79,70,91,79,79,75,95,87,84,84,84,94,83,70,87,84,79,84,85,84,84,79,84,74,85,73,79,79,75,94,85,88,75,82,87,79,87,87,79,85,80,75,75,85,79,79,4.7,50,98,78,98,78,78,78,78,79,79,140,140,79,79,150,150,78,79,79,79,79,79,79,79,79,78,98,79,79,79,79,84,84,79,90,89,64,78,78,79,79,67,56,56,91,69,59,70,62,55,61,81,63,19,44,70,57,81,91,79,79,79,79,79,79,79,79,79,79,62,76,79,98,120,100,69,100,120,79,79,79,78,78,86,79,83,83,170,78,79,79,79,91,71,79,83,79,100,85,79,79,79,140,75,79,79,79,74,100,64,79,79,79,73,76,59,70,88,93,73,80,100,100,110,130,79,79,79,79,120,80,64,110,120,79,79,79,140,130,160,79,190,180,230,62,79,79,92,79,79,79,79,79,79,150,79,79,79,79,79,79,79,79,79,79,79,79,36,55,59,69,69,65,66,81,91,70,95,90,78,76,85,91,80,160,81,130,140,81,110,79,79,79,79,79,73,110,140,110,79,97,94,85,110,99,130,160,110,79,84,84,89,79,83,83,85,57,99,66,120,85,88,88,84,140,110,93,68,90,90,92,90,90,90,90,84,79,84,84,90,90,120,140,68,97,85,71,97,84,61,84,84,120,79,79,79,70,110,73,73,110,140,120,150,79,73,73,73,79,73,73,110,73,79,79,79,79,79,79,79,73,73,79,88,84,90,79,79,79,79,79,200,150,73,73,79,79,64,62,77,55,65,71,50,57,65,50,79,79,79,79,79,79,79,79,58,28,52,82,74,74,73,86,42,61,120,93,79,90,85,92,120,120,140,120,110,79,81,81,84,79,81,81,84,68,94,70,87,81,81,95,81,140,120,85,73,82,82,85,81,88,88,88,80,79,81,81,86,86,120,140,73,90,90,83,79,83,72,81,83,87,79,79,61,52,120,71,110,100,130,89,130,79,74,110,120,79,140,180,110,110,79,79,79,79,79,79,79,97,89,79,79,79,79,79,79,79,90,79,150,150,69,80,79,79,72,67,85,83,83,92,85,82,99,67,79,59,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,42,31,79,140,150,99,180,70,150,88,110,79,120,120,180,79,70,120,150,97,88,83,130,110,91,130,88,160,140,57,64,120,120,140,96,81,61,92,92,100,78,110,130,64,64,97,67,63,84,72,63,88,94,110,120,120,81,79,79,42,110,89,88,96,96,100,100,79,130,120,180,79,170,160,200,66,19,79,79,79,79,79,79,79,79,150,79,79,79,79,79,79,79,79,88,120,70,81,79,79,64,86,88,110,68,97,130,48,88,100,92,96,130,76,82,110,79,79,79,120,150,100,68,110,94,110,79,79,68,48,79,91,130,130,130,92,90,95,150,150,200,110,170,100,110,160,100,100,170,79,79,79,120,110,100,94,110,120,100,90,88,180,170,150,100,95,100,110,100,140,130,110,96,83,110,100,79,100,88,100,110,120,110,100,99,88,79,99,79,79,97,110,88,100,120,110,100,79,79,79,86,79,79,79,79,120,130,130,89,89,89,79,89,79,140,160,160,220,190,190,220,150,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,200,63,160,79,79,79,79,79,79,79,79,79,79,79,21,66,63,63,70,69,70,52,58,67,64,65,90,90,73,73,59,76,94,90,69,69,66,69,61,68,72,72,65,65,74,74,73,69,67,53,66,64,73,56,69,71,66,69,74,64,63,68,48,56,56,110,56,56,56,56,56,56,56,79,79,79,79,75,35,64,56,61,46,57,67,56,56,56,56,56,56,56,56,81,64,68,72,75,68,66,64,84,68,73,85,140,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,68,60,79,62,79,79,56,61,79,60,79,79,62,79,79,79,79,79,79,64,66,69,71,79,68,58,58,74,73,73,74,79,68,61,60,79,61,79,59,79,79,61,84,79,61,61,58,56,0,47,47,0,0,0,0,0,0,79,0,0,54,79,79,38,65,37,37,37,79,65,79,0,0,0,0,36,0,79,79,61,56,55,63,56,58,69,69,73,69,79,79,110,110,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,69,54,85,85,130,66,130,160,42,63,71,18,18,27,50,27,27,34,120,65,40,71,52,83,45,37,32,55,55,34,55,58,38,38,60,57,76,55,63,63,52,56,56,60,57,76,55,63,63,56,56,55,58,41,55,33,60,6.3,150,150,54,54,31,47,57,57,57,56,52,59,57,52,79,51,52,52,52,56,52,52,52,52,56,52,57,57,57,56,57,59,57,52,56,52,52,54,52,62,54,59,57,57,57,52,66,56,54,58,58,79,79,79,79,60,55,60,61,120,56,120,56,120,53,54,57,57,22,51,54,60,41,41,15,57,41,37,0,58,52,58,79,79,79,79,56,56,56,56,56,56,56,56,79,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,59,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,79,56,56,64,43,54,65,45,36,50,71,39,61,66,64,68,79,70,55,220,52,23,130,53,70,72,67,70,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,120,66,68,120,66,68,120,66,84,110,120,75,66,75,68,130,120,120,63,68,69,68,68,68,120,68,120,67,120,68,120,120,66,110,79,120,130,66,66,65,79,130,240,79,120,65,65,65,65,120,65,79,79,79,65,65,90,68,65,76,81,65,65,170,68,66,66,66,66,66,68,68,68,68,23,43,66,81,66,97,68,68,68,68,66,94,120,170,65,65,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,73,74,78,77,67,87,73,86,62,70,86,77,69,75,78,76,81,68,65,75,75,78,71,69,69,69,70,85,65,73,69,74,81,63,67,67,74,87,79,79,79,79,79,79,79,79,79,79,51,63,64,100,56,60,80,110,65,53,130,55,56,95,57,59,91,54,85,92,86,56,88,51,58,53,62,56,56,63,55,87,52,74,63,60,54,60,93,66,66,66,66,59,66,79,79,79,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,79,79,79,79,79,0,0,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,95,110,110,110,95,79,79,79,79,79,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,79,79,79,79,79,79,76,99,71,73,72,80,99,120,71,91,91,71,94,81,120,95,110,130,130,110,130,110,110,130,120,150,130,120,130,120,120,130,110,130,110,110,110,120,110,110,67,78,76,99,92,68,90,99,74,97,97,74,96,74,74,97,84,100,100,84,100,88,84,100,94,94,94,94,94,94,94,94,110,79,130,94,94,130,79,79,97,97,97,97,97,110,97,79,110,79,140,97,97,120,79,79,78,99,99,78,98,100,78,99,84,100,100,84,100,100,84,100,85,85,85,86,86,85,85,85,85,86,85,86,85,100,87,85,76,95,90,76,89,74,110,110,110,79,110,83,89,110,79,79,58,77,72,70,71,75,87,81,83,96,91,83,89,83,100,86,70,95,95,70,94,72,71,87,79,100,100,79,100,79,79,99,120,79,110,95,100,110,79,79,98,120,120,98,120,98,98,79,140,79,130,120,120,130,79,79,100,120,100,100,100,130,100,130,74,98,95,72,95,72,78,79,82,100,100,82,100,99,82,100,120,120,120,120,120,140,120,120,64,80,91,65,100,77,90,110,84,110,110,82,100,93,91,110,84,110,100,78,100,99,91,100,85,110,110,84,110,100,92,110,64,92,67,70,66,88,64,79,110,79,100,69,81,100,79,79,81,100,81,81,81,97,87,81,120,140,140,120,140,120,120,140,150,150,150,150,180,150,150,150,73,97,95,72,95,93,74,95,76,98,97,73,96,95,77,95,74,98,76,67,76,72,77,91,94,95,100,95,110,92,94,92,85,86,85,86,85,85,85,85,89,130,100,79,79,79,79,78,100,33,68,39,39,39,55,33,100,61,56,59,60,72,66,67,71,62,46,82,82,96,60,71,87,90,58,62,110,79,79,79,170,160,130,170,120,110,98,140,110,110,120,140,110,97,86,120,32,60,32,32,60,76,51,99,110,56,79,79,79,79,79,79,81,74,71,77,110,41,70,80,59,69,81,54,66,100,68,97,50,62,120,100,70,66,80,99,57,91,90,91,68,78,83,59,83,100,73,63,68,88,72,130,89,100,110,57,87,120,63,71,56,72,74,54,100,63,76,84,84,81,58,92,78,67,67,76,73,95,62,76,91,80,80,71,86,90,120,83,94,63,63,130,74,88,73,88,68,79,79,79,56,67,46,74,50,79,79,79,79,87,87,87,87,82,82,82,82,82,82,82,88,88,88,88,88,88,97,100,97,100,82,100,97,100,97,82,73,65,54,35,35,50,50,38,53,55,35,23,44,45,44,120,98,110,120,91,91,91,91,84,84,84,84,84,84,84,92,92,92,94,92,91,95,100,95,100,100,95,100,95,84,46,15,40,90,90,90,90,77,77,77,77,77,77,77,110,100,100,110,100,110,91,92,91,92,92,91,92,91,93,38,110,110,96,96,69,69,69,69,69,69,69,69,69,84,84,81,87,81,87,84,84,84,84,84,84,84,84,84,43,43,85,88,87,87,72,72,72,72,72,72,72,72,72,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,41,41,71,68,68,68,68,68,68,68,68,80,86,84,77,84,77,77,84,77,84,84,77,84,77,82,38,38,38,47,67,100,100,100,100,100,100,100,100,100,120,120,120,100,120,100,100,60,50,60,96,96,96,96,96,96,96,96,96,110,110,110,110,110,110,96,110,96,110,110,97,110,97,55,49,74,65,65,65,65,65,65,65,65,65,77,80,80,77,81,77,70,85,70,85,81,83,86,78,80,39,45,39,55,39,39,39,120,120,110,110,95,95,95,75,75,75,75,110,110,110,110,110,110,90,90,90,90,90,90,90,90,57,64,64,64,64,64,64,64,64,64,79,79,79,79,79,79,82,79,82,79,79,79,79,79,79,38,51,37,37,100,100,100,100,100,100,68,68,68,68,68,68,83,83,40,49,74,89,89,89,89,94,94,94,94,110,110,54,92,92,92,92,92,92,82,82,82,82,98,98,50,90,90,77,77,66,90,90,77,77,86,86,86,84,84,84,84,54,78,37,110,110,110,110,110,110,110,82,69,69,69,69,89,89,89,89,130,130,130,110,110,130,130,60,93,69,69,69,69,100,100,100,100,60,96,96,96,96,96,96,55,64,64,64,64,64,64,64,38,63,56,56,56,56,63,63,63,63,80,80,80,80,80,80,80,80,80,80,80,80,91,91,83,83,83,83,91,91,83,83,83,83,91,91,84,84,84,84,91,91,84,84,84,84,88,88,75,75,75,75,88,88,71,71,71,71,90,90,76,76,76,76,44,110,110,62,62,62,62,110,110,73,73,73,73,110,110,73,73,73,73,52,72,72,98,98,98,98,110,110,62,62,62,62,90,90,75,75,75,75,70,70,70,100,100,100,100,100,74,74,100,100,100,100,100,100,69,69,69,69,100,100,71,71,71,71,96,96,69,68,68,69,110,110,70,70,70,70,130,130,64,64,64,64,84,84,76,76,76,76,45,45,84,84,76,76,76,76,110,110,62,62,62,62,110,110,68,68,68,68,41,110,110,70,70,70,70,110,110,62,62,62,62,110,110,70,70,70,70,69,53,110,160,160,170,140,140,160,160,79,79,79,79,79,79,79,79,79,54,54,76,98,120,140,54,76,98,120,140,54,76,98,120,140,54,76,98,120,140,81,140,110,120,140,98,81,81,79,79,79,67,67,52,52,52,63,53,53,43,55,55,59,69,45,45,69,67,55,50,65,65,65,70,69,69,53,41,41,71,30,71,45,71,20,30,82,84,71,45,71,64,79,59,41,20,32,67,67,43,50,53,45,53,45,65,65,56,32,43,50,66,54,67,65,110,71,110,79,69,65,56,20,67,53,62,32,32,62,69,56,48,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,66,66,66,100,66,66,66,66,140,100,66,66,66,100,140,66,66,68,66,66,66,66,66,66,66,100,39,100,39,66,66,100,100,110,64,66,100,66,100,66,66,78,68,66,66,66,66,66,66,66,66,66,0,0,94,61,61,61,61,52,52,52,99,110,110,91,91,98,130,140,52,87,79,52,66,52,52,53,52,52,52,52,52,52,51,68,38,58,200,71,130,42,58,54,79,79,58,58,73,97,65,65,65,77,65,62,79,79,79,79,79,79,41,45,18,72,45,44,31,59,31,49,79,79,79,79,79,79,62,24,32,33,42,61,20,33,36,37,20,0,0,0,0,110,58,69,54,47,62,47,61,57,57,63,110,110,110,110,110,110,69,66,53,47,47,47,52,54,59,43,51,52,50,70,58,61,47,56,43,42,41,42,40,43,39,61,49,53,44,47,53,60,71,44,35,32,47,52,50,63,49,50,56,57,50,57,58,55,48,42,47,49,39,41,41,46,49,44,61,54,48,67,40,45,51,42,57,82,48,48,50,48,48,45,42,55,61,62,57,49,50,56,59,42,84,43,51,57,110,110,110,110,110,110,110,110,49,35,54,58,57,42,64,44,52,51,58,46,45,37,45,40,42,42,53,60,63,55,47,49,42,54,48,46,63,51,56,58,56,47,67,52,63,62,32,45,51,66,110,110,110,110,110,110,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,71,58,73,97,65,65,65,77,65,62,140,140,140,160,140,140,70,58,73,97,65,65,65,77,65,62,140,140,140,160,140,140,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,62,77,93,64,64,70,72,57,52,32,37,62,52,80,69,73,64,73,73,74,100,68,66,66,56,62,62,54,68,74,92,74,61,85,63,57,48,64,54,57,69,56,63,65,35,48,33,39,40,31,31,37,39,19,24,35,29,45,38,38,42,40,32,35,33,38,44,39,39,40,57,40,40,36,36,31,31,40,21,38,60,40,40,33,40,40,40,27,40,44,60,35,40,40,39,39,54,40,21,28,41,36,40,40,39,55,38,100,68,70,40,92,61,69,44,40,55,40,55,61,42,61,98,24,24,61,60,63,61,61,31,78,55,24,92,61,61,37,55,43,55,55,55,61,61,61,61,50,50,72,24,55,24,61,60,41,39,38,41,35,25,25,41,42,17,17,17,17,30,17,17,30,63,63,42,42,42,42,41,37,17,24,42,43,42,39,35,39,39,39,41,43,52,52,0,0,52,52,52,52,56,56,38,57,57,48,41,43,79,79,79,60,58,59,53,46,48,48,79,44,46,33,42,47,45,44,43,47,45,42,45,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,0,0,72,60,63,69,75,69,63,69,77,57,82,69,85,69,82,69,82,69,82,69,70,66,70,66,60,61,60,61,60,61,59,40,79,69,81,68,83,70,81,68,81,68,81,68,32,32,46,30,76,65,76,65,72,64,61,30,59,32,59,32,59,32,93,110,95,100,93,110,81,68,82,70,81,68,81,68,87,67,85,68,87,67,87,67,66,69,61,69,70,45,76,47,70,45,70,45,59,56,75,57,59,56,59,56,59,56,70,41,68,43,70,41,70,41,76,68,76,68,76,68,81,70,76,68,75,65,75,65,110,90,110,90,110,90,94,85,110,90,69,67,69,67,69,57,67,63,75,58,67,63,68,41,85,57,61,36,47,46,92,55,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,70,66,70,66,70,66,70,66,70,66,70,66,70,66,70,66,46,30,46,30,87,67,87,67,87,67,87,67,87,67,87,67,87,67,89,67,89,67,89,67,89,67,89,67,81,70,81,70,83,73,83,73,83,73,83,73,83,73,68,65,68,65,68,65,68,65,100,65,56,49,50,50,76,76,76,76,76,76,76,76,76,79,100,100,97,98,86,84,52,52,52,52,52,52,79,79,79,79,100,100,100,100,79,79,68,68,68,68,68,68,68,68,100,100,120,120,120,120,110,100,40,40,40,40,40,40,40,40,51,51,73,75,73,74,60,56,68,68,68,68,68,68,79,79,100,100,130,130,120,76,79,79,66,66,66,66,66,66,66,66,79,96,79,120,79,120,79,100,99,99,99,99,99,99,99,99,100,110,130,130,120,120,110,110,69,69,56,56,70,70,30,30,67,67,69,69,89,89,79,79,76,76,76,76,76,76,76,76,120,120,140,140,140,140,130,120,68,68,68,68,68,68,68,68,140,140,160,160,160,160,150,150,99,99,99,99,99,99,99,99,140,150,170,170,160,160,150,150,76,76,76,76,76,79,76,76,76,76,75,75,120,68,30,68,68,68,68,68,68,79,68,68,70,83,83,96,120,68,68,68,40,40,30,30,79,79,40,40,32,32,46,59,79,68,68,68,66,66,69,69,67,67,66,66,70,70,68,83,80,70,70,70,79,79,99,99,99,79,99,99,87,97,90,100,130,70,68,79,55,110,55,110,37,28,18,70,40,22,6.9,0,0,0,0,0,64,64,70,70,110,110,65,70,30,30,30,30,50,50,50,50,70,70,60,52,37,52,90,35,0,0,0,0,0,0,0,19,170,150,40,61,61,36,60,83,39,50,50,79,69,46,70,55,55,51,100,36,40,36,36,89,78,78,70,70,60,60,53,35,55,53,61,110,55,77,65,110,65,65,110,65,77,110,31,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46,24,79,79,60,60,46,60,60,46,46,46,46,25,25,60,46,46,46,46,46,46,46,46,46,46,46,46,46,25,25,79,31,31,31,28,31,66,66,66,66,66,66,66,66,79,79,79,70,77,77,70,70,110,82,130,130,110,92,69]});var A=L(),P=t=>{let i=t[64];return([...r])=>{let n=0,g=0,e=r.length;for(;e--;)g=t[r[e].charCodeAt()],n+=g===void 0?i:g;return n}},l=P(A);var c={green:"3C1",blue:"08C",red:"E43",yellow:"DB1",orange:"F73",purple:"94E",pink:"E5B",grey:"999",gray:"999",cyan:"1BC",black:"2A2A2A"};function S({label:t,subject:i,status:r,color:n="blue",style:g,icon:e,iconWidth:a=13,labelColor:s="555",scale:o=1}){if(V(typeof r=="string"," must be string"),t=t===void 0?i:t,!t&&!e)return T({status:r,color:n,style:g,scale:o});n=c[n]||n,s=c[s]||s,a=a*10;let u=e?t!=null&&t.length?a+30:a-18:0,p=e?u+50:50,$=t?l(t):0,d=l(r),h=$+100+u,m=d+100,x=h+m,k=e?' xmlns:xlink="http://www.w3.org/1999/xlink"':"",v=y(5),b=y(5);t=t?f(t):"",r=f(r),n=f(n),s=f(s),e=e&&f(e);let w=W({label:t,status:r});return g==="flat"?` - ${w} - - - - - - ${e?``:""} -`:` - ${w} - - - - - - - - - - - - ${e?``:""} -`}function T({status:t,color:i="blue",style:r,scale:n=1}){V(typeof t=="string"," must be string"),i=c[i]||i||c.blue;let g=l(t),e=g+115,a=y(5),s=y(5);return t=f(t),i=f(i),r==="flat"?` - ${t} - - - - -`:` - ${t} - - - - - - - - - - -`}function f(t){return t.replace(/\u0026/g,"&").replace(/\u003C/g,"<").replace(/\u003E/g,">").replace(/\u0022/g,""").replace(/\u0027/g,"'")}function y(t){let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n {\n const fallbackWidth = charWidthTable[64] // Width as \"@\" for overflows\n\n return ([...text]) => {\n let total = 0\n let charWidth = 0\n let i = text.length\n while (i--) {\n charWidth = charWidthTable[text[i].charCodeAt()]\n total += charWidth === undefined ? fallbackWidth : charWidth\n }\n return total\n }\n}\n\nexport const Verdana110 = calcWidth(widthsVerdana110)\n", "export default {\n green: '3C1',\n blue: '08C',\n red: 'E43',\n yellow: 'DB1',\n orange: 'F73',\n purple: '94E',\n pink: 'E5B',\n grey: '999',\n gray: '999',\n cyan: '1BC',\n black: '2A2A2A'\n} as Record\n", "export { Verdana110 as calcWidth } from './calc-text-width'\nimport { Verdana110 as calcWidth } from './calc-text-width'\nimport colorPresets from './color-presets'\n\nexport type StyleOption = 'flat' | 'classic'\nexport type ColorPreset = keyof typeof colorPresets\n\nexport interface BadgenOptions {\n status: string;\n subject?: string;\n color?: ColorPreset;\n label?: string;\n labelColor?: string\n style?: StyleOption;\n icon?: string;\n iconWidth?: number;\n scale?: number\n}\n\nexport function badgen ({\n label,\n subject,\n status,\n color = 'blue',\n style,\n icon,\n iconWidth = 13,\n labelColor = '555',\n scale = 1\n}: BadgenOptions) {\n typeAssert(typeof status === 'string', ' must be string')\n\n label = label === undefined ? subject : label // subject is deprecated\n if (!label && !icon) {\n return bare({ status, color, style, scale })\n }\n\n color = colorPresets[color] || color\n labelColor = colorPresets[labelColor] || labelColor\n iconWidth = iconWidth * 10\n\n const iconSpanWidth = icon ? (label?.length ? iconWidth + 30 : iconWidth - 18) : 0\n const sbTextStart = icon ? (iconSpanWidth + 50) : 50\n const sbTextWidth = label ? calcWidth(label) : 0\n const stTextWidth = calcWidth(status)\n const sbRectWidth = sbTextWidth + 100 + iconSpanWidth\n const stRectWidth = stTextWidth + 100\n const width = sbRectWidth + stRectWidth\n const xlink = icon ? ' xmlns:xlink=\"http://www.w3.org/1999/xlink\"' : ''\n\n const gradientId = generateRandomID(5)\n const maskId = generateRandomID(5)\n\n label = label ? sanitize(label) : ''\n status = sanitize(status)\n color = sanitize(color)\n labelColor = sanitize(labelColor)\n icon = icon ? sanitize(icon) : icon\n const accessibleText = createAccessibleText({label, status})\n\n if (style === 'flat') {\n return `\n ${accessibleText}\n \n \n \n \n \n ${label}\n ${label}\n ${status}\n ${status}\n \n ${icon ? `` : ''}\n`\n }\n\n return `\n ${accessibleText}\n \n \n \n \n \n \n \n \n \n \n \n ${label}\n ${label}\n ${status}\n ${status}\n \n ${icon ? `` : ''}\n`\n}\n\nfunction bare ({ status, color = 'blue', style, scale = 1 }: BadgenOptions) {\n typeAssert(typeof status === 'string', ' must be string')\n color = colorPresets[color] || color || colorPresets.blue\n\n const stTextWidth = calcWidth(status)\n const stRectWidth = stTextWidth + 115\n\n const gradientId = generateRandomID(5)\n const maskId = generateRandomID(5)\n\n status = sanitize(status)\n color = sanitize(color)\n\n if (style === 'flat') {\n return `\n ${status}\n \n \n \n \n ${status}\n ${status}\n \n`\n }\n\n return `\n ${status}\n \n \n \n \n \n \n \n \n \n \n ${status}\n ${status}\n \n`\n}\n\nfunction sanitize (str: string): string {\n return str\n .replace(/\\u0026/g, '&')\n .replace(/\\u003C/g, '<')\n .replace(/\\u003E/g, '>')\n .replace(/\\u0022/g, '"')\n .replace(/\\u0027/g, ''')\n}\n\ninterface AccessibleTextProps {\n status: string;\n label?: string;\n}\n\nfunction generateRandomID(length: number): string {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n\n return result;\n}\n\nfunction createAccessibleText({label, status}: AccessibleTextProps): string {\n const labelPrefix = label ? `${label}: ` : '';\n return labelPrefix + status;\n}\n\nfunction typeAssert (assertion: boolean, message: string): void {\n if (!assertion) throw new TypeError(message)\n}\n\ndeclare global {\n interface Window {\n badgen: typeof badgen;\n }\n}\n\nif (typeof window === 'object') {\n window.badgen = badgen\n}\n"], - "mappings": "q1yBAEA,GAAM,GAA6B,IAE7B,EAAY,AAAC,GAA6B,CAC9C,GAAM,GAAgB,EAAe,IAErC,MAAO,CAAC,IAAI,KAAU,CACpB,GAAI,GAAQ,EACR,EAAY,EACZ,EAAI,EAAK,OACb,KAAO,KACL,EAAY,EAAe,EAAK,GAAG,WAAW,GAC9C,GAAS,IAAc,OAAY,EAAgB,EAErD,MAAO,EACT,CACF,EAEa,EAAa,EAAU,CAAgB,ECnBpD,GAAO,GAAQ,CACb,MAAO,MACP,KAAM,MACN,IAAK,MACL,OAAQ,MACR,OAAQ,MACR,OAAQ,MACR,KAAM,MACN,KAAM,MACN,KAAM,MACN,KAAM,MACN,MAAO,QACT,ECOO,WAAiB,CACtB,QACA,UACA,SACA,QAAQ,OACR,QACA,OACA,YAAY,GACZ,aAAa,MACb,QAAQ,GACQ,CAIhB,GAHA,EAAW,MAAO,IAAW,SAAU,yBAAyB,EAEhE,EAAQ,IAAU,OAAY,EAAU,EACpC,CAAC,GAAS,CAAC,EACb,MAAO,GAAK,CAAE,SAAQ,QAAO,QAAO,OAAM,CAAC,EAG7C,EAAQ,EAAa,IAAU,EAC/B,EAAa,EAAa,IAAe,EACzC,EAAY,EAAY,GAExB,GAAM,GAAgB,EAAQ,WAAO,OAAS,EAAY,GAAK,EAAY,GAAM,EAC3E,EAAc,EAAQ,EAAgB,GAAM,GAC5C,EAAc,EAAQ,EAAU,CAAK,EAAI,EACzC,EAAc,EAAU,CAAM,EAC9B,EAAc,EAAc,IAAM,EAClC,EAAc,EAAc,IAC5B,EAAQ,EAAc,EACtB,EAAQ,EAAO,8CAAgD,GAE/D,EAAa,EAAiB,CAAC,EAC/B,EAAS,EAAiB,CAAC,EAEjC,EAAQ,EAAQ,EAAS,CAAK,EAAI,GAClC,EAAS,EAAS,CAAM,EACxB,EAAQ,EAAS,CAAK,EACtB,EAAa,EAAS,CAAU,EAChC,EAAO,GAAO,EAAS,CAAI,EAC3B,GAAM,GAAiB,EAAqB,CAAC,QAAO,QAAM,CAAC,EAE3D,MAAI,KAAU,OACL,eAAe,EAAQ,EAAQ,eAAe,EAAQ,oBAAoB,4CAAgD,4BAAgC;AAAA,WAC1J;AAAA;AAAA,mBAEQ,aAAsB;AAAA,mBACtB,SAAa,aAAuB;AAAA;AAAA;AAAA,eAGxC,EAAc,2BAA2B,gCAA0C;AAAA,eACnF,0BAAoC,MAAgB;AAAA,eACpD,EAAc,2BAA2B,gCAA0C;AAAA,eACnF,EAAc,2BAA2B,MAAgB;AAAA;AAAA,IAEpE,EAAO,+BAA+B,+BAAuC,OAAY;AAAA,QAIpF,eAAe,EAAQ,EAAQ,eAAe,EAAQ,oBAAoB,4CAAgD,4BAAgC;AAAA,WACxJ;AAAA,wBACa;AAAA;AAAA;AAAA;AAAA,cAIV,mBAAwB;AAAA,kBACpB;AAAA,mBACC,0BAAoC;AAAA,mBACpC,0BAAoC,SAAa;AAAA,mBACjD,8BAAkC;AAAA;AAAA;AAAA,eAGtC,EAAc,2BAA2B,iCAA2C;AAAA,eACpF,0BAAoC,MAAgB;AAAA,eACpD,EAAc,2BAA2B,iCAA2C;AAAA,eACpF,EAAc,2BAA2B,MAAgB;AAAA;AAAA,IAEpE,EAAO,+BAA+B,+BAAuC,OAAY;AAAA,OAE7F,CAEA,WAAe,CAAE,SAAQ,QAAQ,OAAQ,QAAO,QAAQ,GAAoB,CAC1E,EAAW,MAAO,IAAW,SAAU,yBAAyB,EAChE,EAAQ,EAAa,IAAU,GAAS,EAAa,KAErD,GAAM,GAAc,EAAU,CAAM,EAC9B,EAAc,EAAc,IAE5B,EAAa,EAAiB,CAAC,EAC/B,EAAS,EAAiB,CAAC,EAKjC,MAHA,GAAS,EAAS,CAAM,EACxB,EAAQ,EAAS,CAAK,EAElB,IAAU,OACL,eAAe,EAAQ,EAAc,eAAe,EAAQ,oBAAoB,oEAA8E;AAAA,WAC9J;AAAA;AAAA,mBAEQ,mBAAuB;AAAA;AAAA;AAAA,uCAGH,gCAA0C;AAAA,uCAC1C,MAAgB;AAAA;AAAA,QAK9C,eAAe,EAAQ,EAAc,eAAe,EAAQ,oBAAoB,oEAA8E;AAAA,WAC5J;AAAA,wBACa;AAAA;AAAA;AAAA;AAAA,cAIV,mBAAwB;AAAA,kBACpB;AAAA,mBACC,0BAAoC;AAAA,mBACpC,8BAAwC;AAAA;AAAA;AAAA,uCAGpB,iCAA2C;AAAA,uCAC3C,MAAgB;AAAA;AAAA,OAGvD,CAEA,WAAmB,EAAqB,CACtC,MAAO,GACJ,QAAQ,UAAW,OAAO,EAC1B,QAAQ,UAAW,MAAM,EACzB,QAAQ,UAAW,MAAM,EACzB,QAAQ,UAAW,QAAQ,EAC3B,QAAQ,UAAW,QAAQ,CAChC,CAOA,WAA0B,EAAwB,CAChD,GAAM,GAAa,uDACf,EAAS,GAEb,OAAS,GAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,EAAW,OAAO,KAAK,MAAM,KAAK,OAAO,EAAI,EAAW,MAAM,CAAC,EAG3E,MAAO,EACT,CAEA,WAA8B,CAAC,QAAO,UAAsC,CAE1E,MAAO,AADa,GAAQ,GAAG,MAAY,IACtB,CACvB,CAEA,WAAqB,EAAoB,EAAuB,CAC9D,GAAI,CAAC,EAAW,KAAM,IAAI,WAAU,CAAO,CAC7C,CAQA,AAAI,MAAO,SAAW,UACpB,QAAO,OAAS", - "names": [] -} diff --git a/node_modules/badgen/dist/index.d.ts b/node_modules/badgen/dist/index.d.ts index f397eb3b1..cedecfe7f 100644 --- a/node_modules/badgen/dist/index.d.ts +++ b/node_modules/badgen/dist/index.d.ts @@ -1,11 +1,9 @@ export { Verdana110 as calcWidth } from './calc-text-width'; -import colorPresets from './color-presets'; -export declare type StyleOption = 'flat' | 'classic'; -export declare type ColorPreset = keyof typeof colorPresets; -export interface BadgenOptions { +declare type StyleOption = 'flat' | 'classic'; +interface BadgenOptions { status: string; subject?: string; - color?: ColorPreset; + color?: string; label?: string; labelColor?: string; style?: StyleOption; diff --git a/node_modules/badgen/dist/index.js b/node_modules/badgen/dist/index.js index 0c02a7207..fc75e396b 100644 --- a/node_modules/badgen/dist/index.js +++ b/node_modules/badgen/dist/index.js @@ -1,58 +1,2 @@ -var u=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),W=(t,e)=>{for(var i in e)u(t,i,{get:e[i],enumerable:!0})},F=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let g of P(e))!S.call(t,g)&&g!==i&&u(t,g,{get:()=>e[g],enumerable:!(n=A(e,g))||n.enumerable});return t};var j=t=>F(u({},"__esModule",{value:!0}),t);var V=T((C,D)=>{D.exports=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,43,50,90,70,120,80,30,50,50,70,90,40,50,40,50,70,70,70,70,70,70,70,70,70,70,50,50,90,90,90,60,110,75,75,77,85,70,63,85,83,46,50,76,61,93,82,87,66,87,76,75,68,81,75,110,75,68,75,50,50,50,90,70,70,66,69,57,69,66,39,69,70,30,38,65,30,110,70,67,69,69,47,57,43,70,65,90,65,65,58,70,50,70,90,0,61,110,110,110,110,110,110,110,110,110,110,110,110,110,55,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,55,110,39,43,70,70,70,70,50,70,70,110,60,71,90,0,110,70,60,90,60,60,70,71,70,40,70,60,60,71,110,110,110,60,75,75,75,75,75,75,110,77,70,70,70,70,46,46,46,46,85,82,87,87,87,87,87,90,87,81,81,81,81,68,67,68,66,66,66,66,66,66,110,57,66,66,66,66,30,30,30,30,67,70,67,67,67,67,67,90,67,70,70,70,70,65,69,65,75,66,75,66,75,66,77,57,77,57,77,57,77,57,85,71,85,69,70,66,70,66,70,66,70,66,70,66,85,69,85,69,85,69,85,69,83,70,83,70,46,30,46,30,46,30,46,30,46,30,96,68,50,38,76,65,65,61,30,61,30,61,33,61,50,62,31,82,70,82,70,82,70,80,82,70,87,67,87,67,87,67,120,110,76,47,76,47,76,47,75,57,75,57,75,57,75,57,68,43,68,43,68,43,81,70,81,70,81,69,81,70,81,70,81,69,110,90,68,65,68,75,58,75,58,75,58,33,69,77,64,69,75,62,76,76,59,83,96,64,69,65,60,83,58,59,70,79,72,100,43,43,73,64,42,65,120,81,68,86,89,67,120,98,74,69,70,59,56,65,58,41,74,41,70,83,73,86,78,68,74,67,63,61,61,56,57,70,70,52,50,67,29,48,50,32,140,140,130,94,90,61,110,110,99,76,61,32,32,85,68,76,68,76,68,81,70,76,68,81,70,61,76,61,76,61,100,94,88,69,79,69,72,64,85,68,85,68,61,56,28,140,140,130,85,69,110,61,82,70,75,66,110,110,87,67,72,60,76,61,63,58,60,61,30,27,32,32,76,63,85,68,68,37,70,45,71,61,76,68,75,57,68,43,58,55,81,68,81,100,85,68,67,63,76,61,60,61,85,68,85,68,85,68,85,68,69,57,63,100,63,28,100,100,75,81,56,62,68,55,55,62,62,81,95,75,75,62,61,25,96,69,87,44,86,69,61,69,69,69,56,61,70,70,61,66,86,51,51,71,64,45,70,69,65,59,65,68,68,68,42,41,45,56,53,33,72,100,100,100,69,70,69,68,89,86,84,45,45,47,45,45,45,45,61,61,56,47,48,53,59,41,41,72,73,68,57,85,57,53,63,77,56,59,49,49,49,53,85,58,65,67,69,53,64,51,70,50,49,110,110,130,88,78,96,110,74,77,68,64,71,71,40,40,26,27,27,35,35,51,36,26,52,35,22,28,29,29,31,31,38,39,40,40,70,70,20,70,31,31,20,40,31,31,42,42,31,31,50,50,50,50,70,70,70,70,70,70,23,38,41,20,35,40,31,43,43,43,43,43,42,42,37,46,48,24,24,26,26,32,31,47,47,41,27,31,31,31,31,42,42,50,0,0,53,0,51,68,52,39,49,0,46,51,53,38,47,0,52,52,39,39,39,11,46,47,44,44,26,17,41,48,48,48,48,25,25,0,49,46,21,40,41,38,40,57,53,53,52,52,52,51,68,68,62,62,68,62,79,41,0,40,57,48,41,68,0,0,52,42,53,38,40,51,47,45,52,52,52,57,44,0,45,41,52,48,45,45,56,41,20,48,51,47,83,52,51,51,51,51,51,45,44,36,45,44,44,45,44,51,40,41,45,45,46,37,65,51,32,32,79,64,79,79,68,56,56,56,50,66,79,79,79,79,70,70,75,50,83,96,59,79,97,79,83,100,30,75,75,62,77,70,75,83,87,46,76,75,93,82,71,87,83,66,79,74,68,68,90,75,96,90,46,68,69,56,70,30,69,69,68,65,67,56,50,70,69,30,65,65,70,65,55,67,70,69,56,69,55,69,87,65,90,89,30,69,67,69,89,62,57,64,59,59,70,85,86,61,85,68,73,59,59,56,60,56,73,88,98,92,74,61,74,55,73,73,67,66,81,61,51,45,61,67,56,33,86,58,58,63,67,76,95,80,78,81,81,81,70,70,87,62,77,75,46,46,50,120,120,90,76,83,68,83,75,75,75,62,82,70,110,68,83,83,76,81,93,83,87,83,66,77,68,68,90,75,84,78,110,110,86,100,75,77,110,78,66,68,65,52,68,66,88,58,70,70,65,68,77,70,67,70,69,59,55,65,92,65,71,67,96,98,70,87,63,60,92,66,66,66,70,52,60,57,30,30,38,100,100,70,65,70,65,70,97,85,69,60,99,82,66,59,97,83,94,81,120,110,57,53,76,77,75,63,69,55,69,55,130,110,75,62,96,84,97,85,71,59,69,0,0,0,0,0,0,0,78,63,69,60,70,62,62,52,62,52,67,55,110,88,65,56,76,65,76,65,72,57,90,76,83,70,110,78,110,96,82,66,72,58,66,53,68,65,68,65,75,65,99,74,75,60,78,67,78,70,85,65,85,65,30,100,84,69,60,78,64,78,62,78,63,75,60,96,82,30,72,60,72,60,100,93,63,58,83,66,76,58,100,84,65,56,64,64,78,63,78,63,76,63,87,67,75,63,74,59,69,52,69,52,69,52,75,60,61,46,95,85,65,45,69,55,69,55,68,62,90,95,87,71,59,55,110,89,110,91,68,57,78,70,74,59,78,64,84,76,91,75,110,81,85,68,100,87,75,69,110,88,120,100,76,66,74,68,49,44,98,89,62,58,73,65,79,84,63,81,81,68,71,63,60,80,75,64,57,80,72,66,65,77,79,68,80,61,81,70,59,66,73,67,81,68,81,61,54,63,69,75,69,64,77,79,79,44,37,33,42,29,38,0,79,82,56,67,70,55,58,52,56,63,63,55,30,84,58,54,55,51,57,58,58,30,56,48,58,45,81,48,67,58,58,83,70,56,43,81,65,55,69,59,79,39,44,79,79,79,79,88,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,3.3,15,0,0,0,38,0,28,0,0,28,0,5,44,12,79,79,79,79,79,79,79,79,71,62,47,55,78,35,37,78,71,35,58,63,59,77,76,34,45,73,66,58,63,53,63,73,56,79,76,79,79,79,79,79,68,68,66,31,53,79,79,79,79,79,79,79,79,79,79,79,97,190,93,81,290,120,71,71,86,58,58,53,32,49,93,58,0,0,.9,0,0,0,0,0,0,0,9,32,0,79,27,39,89,35,32,32,43,32,70,32,70,39,70,70,64,64,64,45,45,45,45,100,100,120,120,66,66,64,64,77,77,70,70,70,22,86,60,60,52,45,59,39,43,70,70,0,.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,58,58,58,58,58,58,58,58,58,58,58,58,57,70,60,0,32,32,32,0,47,58,54,70,70,70,70,70,70,70,70,70,64,64,64,64,64,64,64,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,100,100,100,120,120,66,64,86,86,86,86,86,86,60,60,77,77,77,60,60,60,77,77,77,77,77,77,52,52,52,52,59,59,59,59,59,57,64,39,49,49,49,43,43,43,43,43,43,43,43,70,79,70,43,70,70,64,64,35,39,7,4.1,.45,.099,0,0,0,95,61,0,0,0,0,24,0,25,38,0,0,70,0,0,0,0,45,45,51,51,58,58,58,58,58,58,58,58,100,120,64,51,48,57,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,70,70,70,70,70,70,70,64,64,45,45,45,100,64,64,64,86,86,77,77,77,45,45,59,59,59,52,45,45,100,64,64,100,45,64,32,32,70,70,70,43,43,64,64,64,100,100,60,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,96,96,74,84,100,74,70,54,83,83,61,47,64,26,52,120,92,52,37,73,88,79,96,96,96,38,83,100,74,66,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,58,40,41,34,33,79,79,79,79,79,79,56,62,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,0,0,0,0,0,73,73,73,100,80,80,110,58,58,52,74,91,79,60,60,60,60,110,110,110,110,85,87,61,70,68,71,75,82,85,77,55,63,60,58,83,61,71,58,70,56,56,62,87,62,64,64,67,44,45,78,81,81,60,79,63,75,56,73,100,73,54,100,100,100,73,73,73,73,73,73,73,73,100,100,100,100,73,100,100,130,0,0,73,73,73,73,73,85,87,61,82,60,58,87,67,91,79,73,73,52,82,51,53,54,54,56,59,58,72,53,52,55,34,80,80,110,110,80,80,57,82,67,61,80,50,61,62,62,73,120,120,79,98,130,54,72,73,75,83,68,79,79,78,83,79,79,66,78,76,72,70,69,76,58,65,88,85,100,60,60,73,60,67,75,74,60,67,69,79,72,83,60,79,64,62,60,79,81,79,79,79,77,62,72,54,79,79,73,51,100,100,100,73,73,73,73,79,79,100,100,79,79,130,130,73,57,79,79,79,79,79,79,79,79,100,79,79,79,79,73,60,79,62,83,68,73,73,79,79,65,58,53,80,55,67,70,62,76,69,61,60,46,66,44,75,70,30,62,58,70,30,79,79,79,79,79,34,23,32,79,89,110,97,98,78,78,79,79,79,79,73,89,79,79,78,89,76,76,90,92,75,76,79,76,79,73,73,79,75,76,78,75,76,76,76,79,79,76,75,77,75,75,91,73,79,78,78,79,76,75,79,75,73,79,79,12,79,26,23,50,64,64,79,79,79,79,62,62,79,79,67,58,19,79,79,79,19,79,79,79,79,79,79,79,76,90,76,75,79,75,79,79,79,79,79,79,79,93,68,69,70,77,76,70,70,80,77,36,26,73,78,170,46,79,79,79,79,79,79,79,79,79,79,79,89,89,28,79,94,120,71,78,82,95,88,83,94,79,94,94,120,79,120,120,63,84,79,70,65,74,86,92,92,76,70,79,63,76,98,71,74,63,71,73,79,74,63,85,89,67,74,56,79,74,90,79,74,79,74,81,65,79,79,89,56,120,100,120,89,89,89,89,89,79,89,89,120,79,120,120,89,79,79,120,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,95,83,89,89,79,79,74,46,56,62,72,74,57,85,59,75,47,100,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,28,46,48,79,84,100,88,90,91,90,90,62,79,79,70,91,79,79,75,95,87,84,84,84,94,83,70,87,84,79,84,85,84,84,79,84,74,85,73,79,79,75,94,85,88,75,82,87,79,87,87,79,85,80,75,75,85,79,79,4.7,50,98,78,98,78,78,78,78,79,79,140,140,79,79,150,150,78,79,79,79,79,79,79,79,79,78,98,79,79,79,79,84,84,79,90,89,64,78,78,79,79,67,56,56,91,69,59,70,62,55,61,81,63,19,44,70,57,81,91,79,79,79,79,79,79,79,79,79,79,62,76,79,98,120,100,69,100,120,79,79,79,78,78,86,79,83,83,170,78,79,79,79,91,71,79,83,79,100,85,79,79,79,140,75,79,79,79,74,100,64,79,79,79,73,76,59,70,88,93,73,80,100,100,110,130,79,79,79,79,120,80,64,110,120,79,79,79,140,130,160,79,190,180,230,62,79,79,92,79,79,79,79,79,79,150,79,79,79,79,79,79,79,79,79,79,79,79,36,55,59,69,69,65,66,81,91,70,95,90,78,76,85,91,80,160,81,130,140,81,110,79,79,79,79,79,73,110,140,110,79,97,94,85,110,99,130,160,110,79,84,84,89,79,83,83,85,57,99,66,120,85,88,88,84,140,110,93,68,90,90,92,90,90,90,90,84,79,84,84,90,90,120,140,68,97,85,71,97,84,61,84,84,120,79,79,79,70,110,73,73,110,140,120,150,79,73,73,73,79,73,73,110,73,79,79,79,79,79,79,79,73,73,79,88,84,90,79,79,79,79,79,200,150,73,73,79,79,64,62,77,55,65,71,50,57,65,50,79,79,79,79,79,79,79,79,58,28,52,82,74,74,73,86,42,61,120,93,79,90,85,92,120,120,140,120,110,79,81,81,84,79,81,81,84,68,94,70,87,81,81,95,81,140,120,85,73,82,82,85,81,88,88,88,80,79,81,81,86,86,120,140,73,90,90,83,79,83,72,81,83,87,79,79,61,52,120,71,110,100,130,89,130,79,74,110,120,79,140,180,110,110,79,79,79,79,79,79,79,97,89,79,79,79,79,79,79,79,90,79,150,150,69,80,79,79,72,67,85,83,83,92,85,82,99,67,79,59,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,42,31,79,140,150,99,180,70,150,88,110,79,120,120,180,79,70,120,150,97,88,83,130,110,91,130,88,160,140,57,64,120,120,140,96,81,61,92,92,100,78,110,130,64,64,97,67,63,84,72,63,88,94,110,120,120,81,79,79,42,110,89,88,96,96,100,100,79,130,120,180,79,170,160,200,66,19,79,79,79,79,79,79,79,79,150,79,79,79,79,79,79,79,79,88,120,70,81,79,79,64,86,88,110,68,97,130,48,88,100,92,96,130,76,82,110,79,79,79,120,150,100,68,110,94,110,79,79,68,48,79,91,130,130,130,92,90,95,150,150,200,110,170,100,110,160,100,100,170,79,79,79,120,110,100,94,110,120,100,90,88,180,170,150,100,95,100,110,100,140,130,110,96,83,110,100,79,100,88,100,110,120,110,100,99,88,79,99,79,79,97,110,88,100,120,110,100,79,79,79,86,79,79,79,79,120,130,130,89,89,89,79,89,79,140,160,160,220,190,190,220,150,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,200,63,160,79,79,79,79,79,79,79,79,79,79,79,21,66,63,63,70,69,70,52,58,67,64,65,90,90,73,73,59,76,94,90,69,69,66,69,61,68,72,72,65,65,74,74,73,69,67,53,66,64,73,56,69,71,66,69,74,64,63,68,48,56,56,110,56,56,56,56,56,56,56,79,79,79,79,75,35,64,56,61,46,57,67,56,56,56,56,56,56,56,56,81,64,68,72,75,68,66,64,84,68,73,85,140,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,68,60,79,62,79,79,56,61,79,60,79,79,62,79,79,79,79,79,79,64,66,69,71,79,68,58,58,74,73,73,74,79,68,61,60,79,61,79,59,79,79,61,84,79,61,61,58,56,0,47,47,0,0,0,0,0,0,79,0,0,54,79,79,38,65,37,37,37,79,65,79,0,0,0,0,36,0,79,79,61,56,55,63,56,58,69,69,73,69,79,79,110,110,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,69,54,85,85,130,66,130,160,42,63,71,18,18,27,50,27,27,34,120,65,40,71,52,83,45,37,32,55,55,34,55,58,38,38,60,57,76,55,63,63,52,56,56,60,57,76,55,63,63,56,56,55,58,41,55,33,60,6.3,150,150,54,54,31,47,57,57,57,56,52,59,57,52,79,51,52,52,52,56,52,52,52,52,56,52,57,57,57,56,57,59,57,52,56,52,52,54,52,62,54,59,57,57,57,52,66,56,54,58,58,79,79,79,79,60,55,60,61,120,56,120,56,120,53,54,57,57,22,51,54,60,41,41,15,57,41,37,0,58,52,58,79,79,79,79,56,56,56,56,56,56,56,56,79,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,59,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,79,56,56,64,43,54,65,45,36,50,71,39,61,66,64,68,79,70,55,220,52,23,130,53,70,72,67,70,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,120,66,68,120,66,68,120,66,84,110,120,75,66,75,68,130,120,120,63,68,69,68,68,68,120,68,120,67,120,68,120,120,66,110,79,120,130,66,66,65,79,130,240,79,120,65,65,65,65,120,65,79,79,79,65,65,90,68,65,76,81,65,65,170,68,66,66,66,66,66,68,68,68,68,23,43,66,81,66,97,68,68,68,68,66,94,120,170,65,65,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,73,74,78,77,67,87,73,86,62,70,86,77,69,75,78,76,81,68,65,75,75,78,71,69,69,69,70,85,65,73,69,74,81,63,67,67,74,87,79,79,79,79,79,79,79,79,79,79,51,63,64,100,56,60,80,110,65,53,130,55,56,95,57,59,91,54,85,92,86,56,88,51,58,53,62,56,56,63,55,87,52,74,63,60,54,60,93,66,66,66,66,59,66,79,79,79,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,79,79,79,79,79,0,0,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,95,110,110,110,95,79,79,79,79,79,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,79,79,79,79,79,79,76,99,71,73,72,80,99,120,71,91,91,71,94,81,120,95,110,130,130,110,130,110,110,130,120,150,130,120,130,120,120,130,110,130,110,110,110,120,110,110,67,78,76,99,92,68,90,99,74,97,97,74,96,74,74,97,84,100,100,84,100,88,84,100,94,94,94,94,94,94,94,94,110,79,130,94,94,130,79,79,97,97,97,97,97,110,97,79,110,79,140,97,97,120,79,79,78,99,99,78,98,100,78,99,84,100,100,84,100,100,84,100,85,85,85,86,86,85,85,85,85,86,85,86,85,100,87,85,76,95,90,76,89,74,110,110,110,79,110,83,89,110,79,79,58,77,72,70,71,75,87,81,83,96,91,83,89,83,100,86,70,95,95,70,94,72,71,87,79,100,100,79,100,79,79,99,120,79,110,95,100,110,79,79,98,120,120,98,120,98,98,79,140,79,130,120,120,130,79,79,100,120,100,100,100,130,100,130,74,98,95,72,95,72,78,79,82,100,100,82,100,99,82,100,120,120,120,120,120,140,120,120,64,80,91,65,100,77,90,110,84,110,110,82,100,93,91,110,84,110,100,78,100,99,91,100,85,110,110,84,110,100,92,110,64,92,67,70,66,88,64,79,110,79,100,69,81,100,79,79,81,100,81,81,81,97,87,81,120,140,140,120,140,120,120,140,150,150,150,150,180,150,150,150,73,97,95,72,95,93,74,95,76,98,97,73,96,95,77,95,74,98,76,67,76,72,77,91,94,95,100,95,110,92,94,92,85,86,85,86,85,85,85,85,89,130,100,79,79,79,79,78,100,33,68,39,39,39,55,33,100,61,56,59,60,72,66,67,71,62,46,82,82,96,60,71,87,90,58,62,110,79,79,79,170,160,130,170,120,110,98,140,110,110,120,140,110,97,86,120,32,60,32,32,60,76,51,99,110,56,79,79,79,79,79,79,81,74,71,77,110,41,70,80,59,69,81,54,66,100,68,97,50,62,120,100,70,66,80,99,57,91,90,91,68,78,83,59,83,100,73,63,68,88,72,130,89,100,110,57,87,120,63,71,56,72,74,54,100,63,76,84,84,81,58,92,78,67,67,76,73,95,62,76,91,80,80,71,86,90,120,83,94,63,63,130,74,88,73,88,68,79,79,79,56,67,46,74,50,79,79,79,79,87,87,87,87,82,82,82,82,82,82,82,88,88,88,88,88,88,97,100,97,100,82,100,97,100,97,82,73,65,54,35,35,50,50,38,53,55,35,23,44,45,44,120,98,110,120,91,91,91,91,84,84,84,84,84,84,84,92,92,92,94,92,91,95,100,95,100,100,95,100,95,84,46,15,40,90,90,90,90,77,77,77,77,77,77,77,110,100,100,110,100,110,91,92,91,92,92,91,92,91,93,38,110,110,96,96,69,69,69,69,69,69,69,69,69,84,84,81,87,81,87,84,84,84,84,84,84,84,84,84,43,43,85,88,87,87,72,72,72,72,72,72,72,72,72,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,41,41,71,68,68,68,68,68,68,68,68,80,86,84,77,84,77,77,84,77,84,84,77,84,77,82,38,38,38,47,67,100,100,100,100,100,100,100,100,100,120,120,120,100,120,100,100,60,50,60,96,96,96,96,96,96,96,96,96,110,110,110,110,110,110,96,110,96,110,110,97,110,97,55,49,74,65,65,65,65,65,65,65,65,65,77,80,80,77,81,77,70,85,70,85,81,83,86,78,80,39,45,39,55,39,39,39,120,120,110,110,95,95,95,75,75,75,75,110,110,110,110,110,110,90,90,90,90,90,90,90,90,57,64,64,64,64,64,64,64,64,64,79,79,79,79,79,79,82,79,82,79,79,79,79,79,79,38,51,37,37,100,100,100,100,100,100,68,68,68,68,68,68,83,83,40,49,74,89,89,89,89,94,94,94,94,110,110,54,92,92,92,92,92,92,82,82,82,82,98,98,50,90,90,77,77,66,90,90,77,77,86,86,86,84,84,84,84,54,78,37,110,110,110,110,110,110,110,82,69,69,69,69,89,89,89,89,130,130,130,110,110,130,130,60,93,69,69,69,69,100,100,100,100,60,96,96,96,96,96,96,55,64,64,64,64,64,64,64,38,63,56,56,56,56,63,63,63,63,80,80,80,80,80,80,80,80,80,80,80,80,91,91,83,83,83,83,91,91,83,83,83,83,91,91,84,84,84,84,91,91,84,84,84,84,88,88,75,75,75,75,88,88,71,71,71,71,90,90,76,76,76,76,44,110,110,62,62,62,62,110,110,73,73,73,73,110,110,73,73,73,73,52,72,72,98,98,98,98,110,110,62,62,62,62,90,90,75,75,75,75,70,70,70,100,100,100,100,100,74,74,100,100,100,100,100,100,69,69,69,69,100,100,71,71,71,71,96,96,69,68,68,69,110,110,70,70,70,70,130,130,64,64,64,64,84,84,76,76,76,76,45,45,84,84,76,76,76,76,110,110,62,62,62,62,110,110,68,68,68,68,41,110,110,70,70,70,70,110,110,62,62,62,62,110,110,70,70,70,70,69,53,110,160,160,170,140,140,160,160,79,79,79,79,79,79,79,79,79,54,54,76,98,120,140,54,76,98,120,140,54,76,98,120,140,54,76,98,120,140,81,140,110,120,140,98,81,81,79,79,79,67,67,52,52,52,63,53,53,43,55,55,59,69,45,45,69,67,55,50,65,65,65,70,69,69,53,41,41,71,30,71,45,71,20,30,82,84,71,45,71,64,79,59,41,20,32,67,67,43,50,53,45,53,45,65,65,56,32,43,50,66,54,67,65,110,71,110,79,69,65,56,20,67,53,62,32,32,62,69,56,48,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,66,66,66,100,66,66,66,66,140,100,66,66,66,100,140,66,66,68,66,66,66,66,66,66,66,100,39,100,39,66,66,100,100,110,64,66,100,66,100,66,66,78,68,66,66,66,66,66,66,66,66,66,0,0,94,61,61,61,61,52,52,52,99,110,110,91,91,98,130,140,52,87,79,52,66,52,52,53,52,52,52,52,52,52,51,68,38,58,200,71,130,42,58,54,79,79,58,58,73,97,65,65,65,77,65,62,79,79,79,79,79,79,41,45,18,72,45,44,31,59,31,49,79,79,79,79,79,79,62,24,32,33,42,61,20,33,36,37,20,0,0,0,0,110,58,69,54,47,62,47,61,57,57,63,110,110,110,110,110,110,69,66,53,47,47,47,52,54,59,43,51,52,50,70,58,61,47,56,43,42,41,42,40,43,39,61,49,53,44,47,53,60,71,44,35,32,47,52,50,63,49,50,56,57,50,57,58,55,48,42,47,49,39,41,41,46,49,44,61,54,48,67,40,45,51,42,57,82,48,48,50,48,48,45,42,55,61,62,57,49,50,56,59,42,84,43,51,57,110,110,110,110,110,110,110,110,49,35,54,58,57,42,64,44,52,51,58,46,45,37,45,40,42,42,53,60,63,55,47,49,42,54,48,46,63,51,56,58,56,47,67,52,63,62,32,45,51,66,110,110,110,110,110,110,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,71,58,73,97,65,65,65,77,65,62,140,140,140,160,140,140,70,58,73,97,65,65,65,77,65,62,140,140,140,160,140,140,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,62,77,93,64,64,70,72,57,52,32,37,62,52,80,69,73,64,73,73,74,100,68,66,66,56,62,62,54,68,74,92,74,61,85,63,57,48,64,54,57,69,56,63,65,35,48,33,39,40,31,31,37,39,19,24,35,29,45,38,38,42,40,32,35,33,38,44,39,39,40,57,40,40,36,36,31,31,40,21,38,60,40,40,33,40,40,40,27,40,44,60,35,40,40,39,39,54,40,21,28,41,36,40,40,39,55,38,100,68,70,40,92,61,69,44,40,55,40,55,61,42,61,98,24,24,61,60,63,61,61,31,78,55,24,92,61,61,37,55,43,55,55,55,61,61,61,61,50,50,72,24,55,24,61,60,41,39,38,41,35,25,25,41,42,17,17,17,17,30,17,17,30,63,63,42,42,42,42,41,37,17,24,42,43,42,39,35,39,39,39,41,43,52,52,0,0,52,52,52,52,56,56,38,57,57,48,41,43,79,79,79,60,58,59,53,46,48,48,79,44,46,33,42,47,45,44,43,47,45,42,45,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,0,0,72,60,63,69,75,69,63,69,77,57,82,69,85,69,82,69,82,69,82,69,70,66,70,66,60,61,60,61,60,61,59,40,79,69,81,68,83,70,81,68,81,68,81,68,32,32,46,30,76,65,76,65,72,64,61,30,59,32,59,32,59,32,93,110,95,100,93,110,81,68,82,70,81,68,81,68,87,67,85,68,87,67,87,67,66,69,61,69,70,45,76,47,70,45,70,45,59,56,75,57,59,56,59,56,59,56,70,41,68,43,70,41,70,41,76,68,76,68,76,68,81,70,76,68,75,65,75,65,110,90,110,90,110,90,94,85,110,90,69,67,69,67,69,57,67,63,75,58,67,63,68,41,85,57,61,36,47,46,92,55,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,75,66,70,66,70,66,70,66,70,66,70,66,70,66,70,66,70,66,46,30,46,30,87,67,87,67,87,67,87,67,87,67,87,67,87,67,89,67,89,67,89,67,89,67,89,67,81,70,81,70,83,73,83,73,83,73,83,73,83,73,68,65,68,65,68,65,68,65,100,65,56,49,50,50,76,76,76,76,76,76,76,76,76,79,100,100,97,98,86,84,52,52,52,52,52,52,79,79,79,79,100,100,100,100,79,79,68,68,68,68,68,68,68,68,100,100,120,120,120,120,110,100,40,40,40,40,40,40,40,40,51,51,73,75,73,74,60,56,68,68,68,68,68,68,79,79,100,100,130,130,120,76,79,79,66,66,66,66,66,66,66,66,79,96,79,120,79,120,79,100,99,99,99,99,99,99,99,99,100,110,130,130,120,120,110,110,69,69,56,56,70,70,30,30,67,67,69,69,89,89,79,79,76,76,76,76,76,76,76,76,120,120,140,140,140,140,130,120,68,68,68,68,68,68,68,68,140,140,160,160,160,160,150,150,99,99,99,99,99,99,99,99,140,150,170,170,160,160,150,150,76,76,76,76,76,79,76,76,76,76,75,75,120,68,30,68,68,68,68,68,68,79,68,68,70,83,83,96,120,68,68,68,40,40,30,30,79,79,40,40,32,32,46,59,79,68,68,68,66,66,69,69,67,67,66,66,70,70,68,83,80,70,70,70,79,79,99,99,99,79,99,99,87,97,90,100,130,70,68,79,55,110,55,110,37,28,18,70,40,22,6.9,0,0,0,0,0,64,64,70,70,110,110,65,70,30,30,30,30,50,50,50,50,70,70,60,52,37,52,90,35,0,0,0,0,0,0,0,19,170,150,40,61,61,36,60,83,39,50,50,79,69,46,70,55,55,51,100,36,40,36,36,89,78,78,70,70,60,60,53,35,55,53,61,110,55,77,65,110,65,65,110,65,77,110,31,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46,24,79,79,60,60,46,60,60,46,46,46,46,25,25,60,46,46,46,46,46,46,46,46,46,46,46,46,46,25,25,79,31,31,31,28,31,66,66,66,66,66,66,66,66,79,79,79,70,77,77,70,70,110,82,130,130,110,92,69]});var G={};W(G,{badgen:()=>E,calcWidth:()=>o});module.exports=j(G);var z=V(),I=t=>{let e=t[64];return([...i])=>{let n=0,g=0,r=i.length;for(;r--;)g=t[i[r].charCodeAt()],n+=g===void 0?e:g;return n}},o=I(z);var c={green:"3C1",blue:"08C",red:"E43",yellow:"DB1",orange:"F73",purple:"94E",pink:"E5B",grey:"999",gray:"999",cyan:"1BC",black:"2A2A2A"};function E({label:t,subject:e,status:i,color:n="blue",style:g,icon:r,iconWidth:a=13,labelColor:s="555",scale:$=1}){if(B(typeof i=="string"," must be string"),t=t===void 0?e:t,!t&&!r)return O({status:i,color:n,style:g,scale:$});n=c[n]||n,s=c[s]||s,a=a*10;let k=r?t!=null&&t.length?a+30:a-18:0,p=r?k+50:50,d=t?o(t):0,l=o(i),h=d+100+k,m=l+100,x=h+m,v=r?' xmlns:xlink="http://www.w3.org/1999/xlink"':"",b=y(5),L=y(5);t=t?f(t):"",i=f(i),n=f(n),s=f(s),r=r&&f(r);let w=R({label:t,status:i});return g==="flat"?` - ${w} - - - - - - ${r?``:""} -`:` - ${w} - - - - - - - - - - - - ${r?``:""} -`}function O({status:t,color:e="blue",style:i,scale:n=1}){B(typeof t=="string"," must be string"),e=c[e]||e||c.blue;let g=o(t),r=g+115,a=y(5),s=y(5);return t=f(t),e=f(e),i==="flat"?` - ${t} - - - - -`:` - ${t} - - - - - - - - - - -`}function f(t){return t.replace(/\u0026/g,"&").replace(/\u003C/g,"<").replace(/\u003E/g,">").replace(/\u0022/g,""").replace(/\u0027/g,"'")}function y(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",i="";for(let n=0;n must be string");t=t===undefined?e:t;if(!t&&!l){return bare({status:n,color:i,style:a})}i=s.default[i]||i;f=s.default[f]||f;o=o*10;const g=l?t.length?o+30:o-18:0;const c=l?g+50:50;const h=r.Verdana110(t);const u=r.Verdana110(n);const $=h+100+g;const d=u+100;const p=$+d;const w=l?' xmlns:xlink="http://www.w3.org/1999/xlink"':"";t=sanitize(t);n=sanitize(n);if(a==="flat"){return`\n \n \n \n \n \n ${t}\n ${t}\n ${n}\n ${n}\n \n ${l?``:""}\n`}return`\n \n \n \n \n \n \n \n \n \n \n \n ${t}\n ${t}\n ${n}\n ${n}\n \n ${l?``:""}\n`}e.badgen=badgen;function bare({status:t,color:e,style:n}){typeAssert(typeof t==="string"," must be string");e=s.default[e]||e||s.default.blue;const i=r.Verdana110(t);const a=i+115;t=sanitize(t);if(n==="flat"){return`\n \n \n \n \n ${t}\n ${t}\n \n`}return`\n \n \n \n \n \n \n \n \n \n \n ${t}\n ${t}\n \n`}function sanitize(t){return t.replace(/\u0026/g,"&").replace(/\u003C/g,"<")}function typeAssert(t,e){if(!t)throw new TypeError(e)}if(typeof window==="object"){window.badgen=badgen}},363:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:true});const i=n(261);const r=t=>{const e=t[64];return([...n])=>{let i=0;let r=0;let s=n.length;while(s--){r=t[n[s].charCodeAt()];i+=r===undefined?e:r}return i}};e.Verdana110=r(i)}}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/badgen/dist/index.js.map b/node_modules/badgen/dist/index.js.map index ad78f4576..7559cfc26 100644 --- a/node_modules/badgen/dist/index.js.map +++ b/node_modules/badgen/dist/index.js.map @@ -1,7 +1 @@ -{ - "version": 3, - "sources": ["../src/index.ts", "../src/calc-text-width.ts", "../src/color-presets.ts"], - "sourcesContent": ["export { Verdana110 as calcWidth } from './calc-text-width'\nimport { Verdana110 as calcWidth } from './calc-text-width'\nimport colorPresets from './color-presets'\n\nexport type StyleOption = 'flat' | 'classic'\nexport type ColorPreset = keyof typeof colorPresets\n\nexport interface BadgenOptions {\n status: string;\n subject?: string;\n color?: ColorPreset;\n label?: string;\n labelColor?: string\n style?: StyleOption;\n icon?: string;\n iconWidth?: number;\n scale?: number\n}\n\nexport function badgen ({\n label,\n subject,\n status,\n color = 'blue',\n style,\n icon,\n iconWidth = 13,\n labelColor = '555',\n scale = 1\n}: BadgenOptions) {\n typeAssert(typeof status === 'string', ' must be string')\n\n label = label === undefined ? subject : label // subject is deprecated\n if (!label && !icon) {\n return bare({ status, color, style, scale })\n }\n\n color = colorPresets[color] || color\n labelColor = colorPresets[labelColor] || labelColor\n iconWidth = iconWidth * 10\n\n const iconSpanWidth = icon ? (label?.length ? iconWidth + 30 : iconWidth - 18) : 0\n const sbTextStart = icon ? (iconSpanWidth + 50) : 50\n const sbTextWidth = label ? calcWidth(label) : 0\n const stTextWidth = calcWidth(status)\n const sbRectWidth = sbTextWidth + 100 + iconSpanWidth\n const stRectWidth = stTextWidth + 100\n const width = sbRectWidth + stRectWidth\n const xlink = icon ? ' xmlns:xlink=\"http://www.w3.org/1999/xlink\"' : ''\n\n const gradientId = generateRandomID(5)\n const maskId = generateRandomID(5)\n\n label = label ? sanitize(label) : ''\n status = sanitize(status)\n color = sanitize(color)\n labelColor = sanitize(labelColor)\n icon = icon ? sanitize(icon) : icon\n const accessibleText = createAccessibleText({label, status})\n\n if (style === 'flat') {\n return `\n ${accessibleText}\n \n \n \n \n \n ${label}\n ${label}\n ${status}\n ${status}\n \n ${icon ? `` : ''}\n`\n }\n\n return `\n ${accessibleText}\n \n \n \n \n \n \n \n \n \n \n \n ${label}\n ${label}\n ${status}\n ${status}\n \n ${icon ? `` : ''}\n`\n}\n\nfunction bare ({ status, color = 'blue', style, scale = 1 }: BadgenOptions) {\n typeAssert(typeof status === 'string', ' must be string')\n color = colorPresets[color] || color || colorPresets.blue\n\n const stTextWidth = calcWidth(status)\n const stRectWidth = stTextWidth + 115\n\n const gradientId = generateRandomID(5)\n const maskId = generateRandomID(5)\n\n status = sanitize(status)\n color = sanitize(color)\n\n if (style === 'flat') {\n return `\n ${status}\n \n \n \n \n ${status}\n ${status}\n \n`\n }\n\n return `\n ${status}\n \n \n \n \n \n \n \n \n \n \n ${status}\n ${status}\n \n`\n}\n\nfunction sanitize (str: string): string {\n return str\n .replace(/\\u0026/g, '&')\n .replace(/\\u003C/g, '<')\n .replace(/\\u003E/g, '>')\n .replace(/\\u0022/g, '"')\n .replace(/\\u0027/g, ''')\n}\n\ninterface AccessibleTextProps {\n status: string;\n label?: string;\n}\n\nfunction generateRandomID(length: number): string {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n\n return result;\n}\n\nfunction createAccessibleText({label, status}: AccessibleTextProps): string {\n const labelPrefix = label ? `${label}: ` : '';\n return labelPrefix + status;\n}\n\nfunction typeAssert (assertion: boolean, message: string): void {\n if (!assertion) throw new TypeError(message)\n}\n\ndeclare global {\n interface Window {\n badgen: typeof badgen;\n }\n}\n\nif (typeof window === 'object') {\n window.badgen = badgen\n}\n", "// import widthsVerdana110 from './widths-verdana-110.json'\n// @ts-ignore\nconst widthsVerdana110: number[] = require('./widths-verdana-110.json')\n\nconst calcWidth = (charWidthTable: number[]) => {\n const fallbackWidth = charWidthTable[64] // Width as \"@\" for overflows\n\n return ([...text]) => {\n let total = 0\n let charWidth = 0\n let i = text.length\n while (i--) {\n charWidth = charWidthTable[text[i].charCodeAt()]\n total += charWidth === undefined ? fallbackWidth : charWidth\n }\n return total\n }\n}\n\nexport const Verdana110 = calcWidth(widthsVerdana110)\n", "export default {\n green: '3C1',\n blue: '08C',\n red: 'E43',\n yellow: 'DB1',\n orange: 'F73',\n purple: '94E',\n pink: 'E5B',\n grey: '999',\n gray: '999',\n cyan: '1BC',\n black: '2A2A2A'\n} as Record\n"], - "mappings": "uuzBAAA,iECEA,GAAM,GAA6B,IAE7B,EAAY,AAAC,GAA6B,CAC9C,GAAM,GAAgB,EAAe,IAErC,MAAO,CAAC,IAAI,KAAU,CACpB,GAAI,GAAQ,EACR,EAAY,EACZ,EAAI,EAAK,OACb,KAAO,KACL,EAAY,EAAe,EAAK,GAAG,WAAW,GAC9C,GAAS,IAAc,OAAY,EAAgB,EAErD,MAAO,EACT,CACF,EAEa,EAAa,EAAU,CAAgB,ECnBpD,GAAO,GAAQ,CACb,MAAO,MACP,KAAM,MACN,IAAK,MACL,OAAQ,MACR,OAAQ,MACR,OAAQ,MACR,KAAM,MACN,KAAM,MACN,KAAM,MACN,KAAM,MACN,MAAO,QACT,EFOO,WAAiB,CACtB,QACA,UACA,SACA,QAAQ,OACR,QACA,OACA,YAAY,GACZ,aAAa,MACb,QAAQ,GACQ,CAIhB,GAHA,EAAW,MAAO,IAAW,SAAU,yBAAyB,EAEhE,EAAQ,IAAU,OAAY,EAAU,EACpC,CAAC,GAAS,CAAC,EACb,MAAO,GAAK,CAAE,SAAQ,QAAO,QAAO,OAAM,CAAC,EAG7C,EAAQ,EAAa,IAAU,EAC/B,EAAa,EAAa,IAAe,EACzC,EAAY,EAAY,GAExB,GAAM,GAAgB,EAAQ,WAAO,OAAS,EAAY,GAAK,EAAY,GAAM,EAC3E,EAAc,EAAQ,EAAgB,GAAM,GAC5C,EAAc,EAAQ,EAAU,CAAK,EAAI,EACzC,EAAc,EAAU,CAAM,EAC9B,EAAc,EAAc,IAAM,EAClC,EAAc,EAAc,IAC5B,EAAQ,EAAc,EACtB,EAAQ,EAAO,8CAAgD,GAE/D,EAAa,EAAiB,CAAC,EAC/B,EAAS,EAAiB,CAAC,EAEjC,EAAQ,EAAQ,EAAS,CAAK,EAAI,GAClC,EAAS,EAAS,CAAM,EACxB,EAAQ,EAAS,CAAK,EACtB,EAAa,EAAS,CAAU,EAChC,EAAO,GAAO,EAAS,CAAI,EAC3B,GAAM,GAAiB,EAAqB,CAAC,QAAO,QAAM,CAAC,EAE3D,MAAI,KAAU,OACL,eAAe,EAAQ,EAAQ,eAAe,EAAQ,oBAAoB,4CAAgD,4BAAgC;AAAA,WAC1J;AAAA;AAAA,mBAEQ,aAAsB;AAAA,mBACtB,SAAa,aAAuB;AAAA;AAAA;AAAA,eAGxC,EAAc,2BAA2B,gCAA0C;AAAA,eACnF,0BAAoC,MAAgB;AAAA,eACpD,EAAc,2BAA2B,gCAA0C;AAAA,eACnF,EAAc,2BAA2B,MAAgB;AAAA;AAAA,IAEpE,EAAO,+BAA+B,+BAAuC,OAAY;AAAA,QAIpF,eAAe,EAAQ,EAAQ,eAAe,EAAQ,oBAAoB,4CAAgD,4BAAgC;AAAA,WACxJ;AAAA,wBACa;AAAA;AAAA;AAAA;AAAA,cAIV,mBAAwB;AAAA,kBACpB;AAAA,mBACC,0BAAoC;AAAA,mBACpC,0BAAoC,SAAa;AAAA,mBACjD,8BAAkC;AAAA;AAAA;AAAA,eAGtC,EAAc,2BAA2B,iCAA2C;AAAA,eACpF,0BAAoC,MAAgB;AAAA,eACpD,EAAc,2BAA2B,iCAA2C;AAAA,eACpF,EAAc,2BAA2B,MAAgB;AAAA;AAAA,IAEpE,EAAO,+BAA+B,+BAAuC,OAAY;AAAA,OAE7F,CAEA,WAAe,CAAE,SAAQ,QAAQ,OAAQ,QAAO,QAAQ,GAAoB,CAC1E,EAAW,MAAO,IAAW,SAAU,yBAAyB,EAChE,EAAQ,EAAa,IAAU,GAAS,EAAa,KAErD,GAAM,GAAc,EAAU,CAAM,EAC9B,EAAc,EAAc,IAE5B,EAAa,EAAiB,CAAC,EAC/B,EAAS,EAAiB,CAAC,EAKjC,MAHA,GAAS,EAAS,CAAM,EACxB,EAAQ,EAAS,CAAK,EAElB,IAAU,OACL,eAAe,EAAQ,EAAc,eAAe,EAAQ,oBAAoB,oEAA8E;AAAA,WAC9J;AAAA;AAAA,mBAEQ,mBAAuB;AAAA;AAAA;AAAA,uCAGH,gCAA0C;AAAA,uCAC1C,MAAgB;AAAA;AAAA,QAK9C,eAAe,EAAQ,EAAc,eAAe,EAAQ,oBAAoB,oEAA8E;AAAA,WAC5J;AAAA,wBACa;AAAA;AAAA;AAAA;AAAA,cAIV,mBAAwB;AAAA,kBACpB;AAAA,mBACC,0BAAoC;AAAA,mBACpC,8BAAwC;AAAA;AAAA;AAAA,uCAGpB,iCAA2C;AAAA,uCAC3C,MAAgB;AAAA;AAAA,OAGvD,CAEA,WAAmB,EAAqB,CACtC,MAAO,GACJ,QAAQ,UAAW,OAAO,EAC1B,QAAQ,UAAW,MAAM,EACzB,QAAQ,UAAW,MAAM,EACzB,QAAQ,UAAW,QAAQ,EAC3B,QAAQ,UAAW,QAAQ,CAChC,CAOA,WAA0B,EAAwB,CAChD,GAAM,GAAa,uDACf,EAAS,GAEb,OAAS,GAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,EAAW,OAAO,KAAK,MAAM,KAAK,OAAO,EAAI,EAAW,MAAM,CAAC,EAG3E,MAAO,EACT,CAEA,WAA8B,CAAC,QAAO,UAAsC,CAE1E,MAAO,AADa,GAAQ,GAAG,MAAY,IACtB,CACvB,CAEA,WAAqB,EAAoB,EAAuB,CAC9D,GAAI,CAAC,EAAW,KAAM,IAAI,WAAU,CAAO,CAC7C,CAQA,AAAI,MAAO,SAAW,UACpB,QAAO,OAAS", - "names": [] -} +"{\"version\":3,\"sources\":[\"/webpack/bootstrap\",\"../src/color-presets.ts\",\"../src/index.ts\",\"../src/calc-text-width.ts\"],\"names\":[\"installedModules\",\"__webpack_require__\",\"moduleId\",\"exports\",\"module\",\"i\",\"l\",\"modules\",\"call\",\"ab\",\"__dirname\",\"startup\",\"default\",\"green\",\"blue\",\"red\",\"yellow\",\"orange\",\"purple\",\"pink\",\"grey\",\"gray\",\"cyan\",\"black\",\"calc_text_width_1\",\"calcWidth\",\"Verdana110\",\"calc_text_width_2\",\"color_presets_1\",\"badgen\",\"label\",\"subject\",\"status\",\"color\",\"style\",\"icon\",\"iconWidth\",\"labelColor\",\"scale\",\"typeAssert\",\"undefined\",\"bare\",\"iconSpanWidth\",\"length\",\"sbTextStart\",\"sbTextWidth\",\"stTextWidth\",\"sbRectWidth\",\"stRectWidth\",\"width\",\"xlink\",\"sanitize\",\"str\",\"replace\",\"assertion\",\"message\",\"TypeError\",\"window\",\"widthsVerdana110\",\"charWidthTable\",\"fallbackWidth\",\"text\",\"total\",\"charWidth\",\"charCodeAt\"],\"mappings\":\"0CACA,IAAAA,EAAA,GAGA,SAAAC,oBAAAC,GAGA,GAAAF,EAAAE,GAAA,CACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,EAAA,MACAH,QAAA,IAIAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,EAAAA,EAAAD,QAAAF,qBAGAG,EAAAE,EAAA,KAGA,OAAAF,EAAAD,QAIAF,oBAAAQ,GAAAC,UAAA,IAGA,SAAAC,UAEA,OAAAV,oBAAA,KAIA,OAAAU,8FCrCAR,EAAAS,QAAe,CACbC,MAAO,MACPC,KAAM,MACNC,IAAK,MACLC,OAAQ,MACRC,OAAQ,MACRC,OAAQ,MACRC,KAAM,MACNC,KAAM,MACNC,KAAM,MACNC,KAAM,MACNC,MAAO,+2yBCXT,IAAAC,EAAAvB,EAAA,KAASE,EAAAsB,UAAAD,EAAAE,WACT,MAAAC,EAAA1B,EAAA,KACA,MAAA2B,EAAA3B,EAAA,KAgBA,SAAgB4B,QAAQC,MACtBA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAQ,OAAMC,MACdA,EAAKC,KACLA,EAAIC,UACJA,EAAY,GAAEC,WACdA,EAAa,MAAKC,MAClBA,EAAQ,IAERC,kBAAkBP,IAAW,SAAU,2BAEvCF,EAAQA,IAAUU,UAAYT,EAAUD,EACxC,IAAKA,IAAUK,EAAM,CACnB,OAAOM,KAAK,CAAET,OAAAA,EAAQC,MAAAA,EAAOC,MAAAA,IAG/BD,EAAQL,EAAAhB,QAAaqB,IAAUA,EAC/BI,EAAaT,EAAAhB,QAAayB,IAAeA,EACzCD,EAAYA,EAAY,GAExB,MAAMM,EAAgBP,EAAQL,EAAMa,OAASP,EAAY,GAAKA,EAAY,GAAM,EAChF,MAAMQ,EAAcT,EAAQO,EAAgB,GAAM,GAClD,MAAMG,EAAclB,EAAAD,WAAUI,GAC9B,MAAMgB,EAAcnB,EAAAD,WAAUM,GAC9B,MAAMe,EAAcF,EAAc,IAAMH,EACxC,MAAMM,EAAcF,EAAc,IAClC,MAAMG,EAAQF,EAAcC,EAC5B,MAAME,EAAQf,EAAO,8CAAgD,GAErEL,EAAQqB,SAASrB,GACjBE,EAASmB,SAASnB,GAElB,GAAIE,IAAU,OAAQ,CACpB,qBAAsBI,EAAQW,EAAQ,eAAeX,EAAQ,oBAAoBW,4CAAgDC,+BAElHb,aAAsBU,uCACtBd,SAAac,aAAuBC,+IAGxCJ,EAAc,2BAA2BC,gCAA0Cf,0BACnFc,0BAAoCC,MAAgBf,0BACpDiB,EAAc,2BAA2BD,gCAA0Cd,0BACnFe,EAAc,2BAA2BD,MAAgBd,uBAEpEG,iCAAsCC,+BAAuCD,OAAY,aAI3F,qBAAsBG,EAAQW,EAAQ,eAAeX,EAAQ,oBAAoBW,4CAAgDC,0MAKrGD,wFAEXF,0BAAoCV,0BACpCW,0BAAoCf,SAAac,0BACjDE,8JAGJL,EAAc,2BAA2BC,iCAA2Cf,0BACpFc,0BAAoCC,MAAgBf,0BACpDiB,EAAc,2BAA2BD,iCAA2Cd,0BACpFe,EAAc,2BAA2BD,MAAgBd,uBAEpEG,iCAAsCC,+BAAuCD,OAAY,aAnE7FhC,EAAA0B,OAAAA,OAuEA,SAASY,MAAMT,OAAEA,EAAMC,MAAEA,EAAKC,MAAEA,IAC9BK,kBAAkBP,IAAW,SAAU,2BACvCC,EAAQL,EAAAhB,QAAaqB,IAAUA,GAASL,EAAAhB,QAAaE,KAErD,MAAMgC,EAAcnB,EAAAD,WAAUM,GAC9B,MAAMgB,EAAcF,EAAc,IAElCd,EAASmB,SAASnB,GAElB,GAAIE,IAAU,OAAQ,CACpB,qBAAsBc,EAAc,gCAAgCA,uEAErDf,mBAAuBe,uKAGHF,gCAA0Cd,kDAC1Cc,MAAgBd,2BAKrD,qBAAsBgB,EAAc,gCAAgCA,kPAKxCA,wFAEXA,0BAAoCf,gCACpCe,sLAGoBF,iCAA2Cd,kDAC3Cc,MAAgBd,2BAKvD,SAASmB,SAAUC,GACjB,OAAOA,EAAIC,QAAQ,UAAW,SAASA,QAAQ,UAAW,QAG5D,SAASd,WAAYe,EAAoBC,GACvC,IAAKD,EAAW,MAAM,IAAIE,UAAUD,GAStC,UAAWE,SAAW,SAAU,CAC9BA,OAAO5B,OAASA,6FC5IlB,MAAM6B,EAAmBzD,EAAQ,KAEjC,MAAMwB,EAAakC,IACjB,MAAMC,EAAgBD,EAAe,IAErC,MAAO,KAAKE,MACV,IAAIC,EAAQ,EACZ,IAAIC,EAAY,EAChB,IAAI1D,EAAIwD,EAAKlB,OACb,MAAOtC,IAAK,CACV0D,EAAYJ,EAAeE,EAAKxD,GAAG2D,cACnCF,GAASC,IAAcvB,UAAYoB,EAAgBG,EAErD,OAAOD,IAIE3D,EAAAuB,WAAaD,EAAUiC\",\"file\":\"index.js\",\"sourcesContent\":[\" \\t// The module cache\\n \\tvar installedModules = {};\\n\\n \\t// The require function\\n \\tfunction __webpack_require__(moduleId) {\\n\\n \\t\\t// Check if module is in cache\\n \\t\\tif(installedModules[moduleId]) {\\n \\t\\t\\treturn installedModules[moduleId].exports;\\n \\t\\t}\\n \\t\\t// Create a new module (and put it into the cache)\\n \\t\\tvar module = installedModules[moduleId] = {\\n \\t\\t\\ti: moduleId,\\n \\t\\t\\tl: false,\\n \\t\\t\\texports: {}\\n \\t\\t};\\n\\n \\t\\t// Execute the module function\\n \\t\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\n\\n \\t\\t// Flag the module as loaded\\n \\t\\tmodule.l = true;\\n\\n \\t\\t// Return the exports of the module\\n \\t\\treturn module.exports;\\n \\t}\\n\\n\\n \\t__webpack_require__.ab = __dirname + \\\"/\\\";\\n\\n \\t// the startup function\\n \\tfunction startup() {\\n \\t\\t// Load entry module and return exports\\n \\t\\treturn __webpack_require__(325);\\n \\t};\\n\\n \\t// run startup\\n \\treturn startup();\\n\",\"export default {\\n green: '3C1',\\n blue: '08C',\\n red: 'E43',\\n yellow: 'DB1',\\n orange: 'F73',\\n purple: '94E',\\n pink: 'E5B',\\n grey: '999',\\n gray: '999',\\n cyan: '1BC',\\n black: '2A2A2A'\\n}\\n\",\"export { Verdana110 as calcWidth } from './calc-text-width'\\nimport { Verdana110 as calcWidth } from './calc-text-width'\\nimport colorPresets from './color-presets'\\n\\ntype StyleOption = 'flat' | 'classic'\\n\\ninterface BadgenOptions {\\n status: string;\\n subject?: string;\\n color?: string;\\n label?: string;\\n labelColor?: string\\n style?: StyleOption;\\n icon?: string;\\n iconWidth?: number;\\n scale?: number\\n}\\n\\nexport function badgen ({\\n label,\\n subject,\\n status,\\n color = 'blue',\\n style,\\n icon,\\n iconWidth = 13,\\n labelColor = '555',\\n scale = 1\\n}: BadgenOptions) {\\n typeAssert(typeof status === 'string', ' must be string')\\n\\n label = label === undefined ? subject : label // subject is deprecated\\n if (!label && !icon) {\\n return bare({ status, color, style })\\n }\\n\\n color = colorPresets[color] || color\\n labelColor = colorPresets[labelColor] || labelColor\\n iconWidth = iconWidth * 10\\n\\n const iconSpanWidth = icon ? (label.length ? iconWidth + 30 : iconWidth - 18) : 0\\n const sbTextStart = icon ? (iconSpanWidth + 50) : 50\\n const sbTextWidth = calcWidth(label)\\n const stTextWidth = calcWidth(status)\\n const sbRectWidth = sbTextWidth + 100 + iconSpanWidth\\n const stRectWidth = stTextWidth + 100\\n const width = sbRectWidth + stRectWidth\\n const xlink = icon ? ' xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\"' : ''\\n\\n label = sanitize(label)\\n status = sanitize(status)\\n\\n if (style === 'flat') {\\n return `\\n \\n \\n \\n \\n \\n ${label}\\n ${label}\\n ${status}\\n ${status}\\n \\n ${icon ? `` : ''}\\n`\\n }\\n\\n return `\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n ${label}\\n ${label}\\n ${status}\\n ${status}\\n \\n ${icon ? `` : ''}\\n`\\n}\\n\\nfunction bare ({ status, color, style }) {\\n typeAssert(typeof status === 'string', ' must be string')\\n color = colorPresets[color] || color || colorPresets.blue\\n\\n const stTextWidth = calcWidth(status)\\n const stRectWidth = stTextWidth + 115\\n\\n status = sanitize(status)\\n\\n if (style === 'flat') {\\n return `\\n \\n \\n \\n \\n ${status}\\n ${status}\\n \\n`\\n }\\n\\n return `\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n ${status}\\n ${status}\\n \\n`\\n}\\n\\nfunction sanitize (str: string): string {\\n return str.replace(/\\\\u0026/g, '&').replace(/\\\\u003C/g, '<')\\n}\\n\\nfunction typeAssert (assertion: boolean, message: string): void {\\n if (!assertion) throw new TypeError(message)\\n}\\n\\ndeclare global {\\n interface Window {\\n badgen: typeof badgen;\\n }\\n}\\n\\nif (typeof window === 'object') {\\n window.badgen = badgen\\n}\\n\",\"// import widthsVerdana110 from './widths-verdana-110.json'\\n// @ts-ignore\\nconst widthsVerdana110 = require('./widths-verdana-110.json')\\n\\nconst calcWidth = (charWidthTable) => {\\n const fallbackWidth = charWidthTable[64] // Width as \\\"@\\\" for overflows\\n\\n return ([...text]) => {\\n let total = 0\\n let charWidth = 0\\n let i = text.length\\n while (i--) {\\n charWidth = charWidthTable[text[i].charCodeAt()]\\n total += charWidth === undefined ? fallbackWidth : charWidth\\n }\\n return total\\n }\\n}\\n\\nexport const Verdana110 = calcWidth(widthsVerdana110)\\n\"]}" \ No newline at end of file diff --git a/node_modules/badgen/package.json b/node_modules/badgen/package.json index 027edd535..cf85c49f4 100644 --- a/node_modules/badgen/package.json +++ b/node_modules/badgen/package.json @@ -1,28 +1,28 @@ { - "_from": "badgen", - "_id": "badgen@3.2.3", + "_from": "badgen@^3.0.1", + "_id": "badgen@3.0.1", "_inBundle": false, - "_integrity": "sha512-svDuwkc63E/z0ky3drpUppB83s/nlgDciH9m+STwwQoWyq7yCgew1qEfJ+9axkKdNq7MskByptWUN9j1PGMwFA==", + "_integrity": "sha512-ANQ8b2/zOvqLUMJ5fLgUCO7xRmOqFx9+ZOta9p3Taudd9c/gHEAh+5Ivnr2zFgj9kguTzXKkEzfI48hDwGWNcA==", "_location": "/badgen", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "range", "registry": true, - "raw": "badgen", + "raw": "badgen@^3.0.1", "name": "badgen", "escapedName": "badgen", - "rawSpec": "", + "rawSpec": "^3.0.1", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "^3.0.1" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/badgen/-/badgen-3.2.3.tgz", - "_shasum": "d050e3fa99e5929e9b93cab98d8fb612b5a8b2ef", - "_spec": "badgen", - "_where": "/home/ubuntu/resilientdb", + "_resolved": "https://registry.npmjs.org/badgen/-/badgen-3.0.1.tgz", + "_shasum": "1d57d1241c61b0c9c19a502fda71ef0364ccf9c9", + "_spec": "badgen@^3.0.1", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge", "author": { "name": "Amio", "email": "amio.cn@gmail.com" @@ -34,12 +34,13 @@ "deprecated": false, "description": "Fast svg badge generator.", "devDependencies": { - "@types/node": "^14.0.14", + "@types/node": "^12.7.9", + "@zeit/ncc": "^0.20.5", "benchmark": "^2.1.4", - "esbuild": "^0.14.38", - "serve-marked": "^3.1.0", - "tap": "^16.1.0", - "typescript": "^4.1.2" + "serve-marked": "^2.0.2", + "standard": "^14.3.1", + "tap": "^14.6.9", + "typescript": "^3.7.0-beta" }, "homepage": "https://github.com/amio/badgen#readme", "license": "MIT", @@ -51,20 +52,14 @@ }, "scripts": { "bench": "node bench/index.js", - "build": "npm run build:browser && npm run build:node", - "build:browser": "npm run esbuild -- --outfile=dist/index.browser.js", - "build:node": "npm run esbuild -- --platform=node --outfile=dist/index.js", - "build:types": "tsc --emitDeclarationOnly", - "esbuild": "esbuild src/index.ts --bundle --minify --sourcemap", - "postbuild": "npm run build:types", + "build": "ncc -s -m --no-source-map-register build src/index.ts", "prebuild": "rm -rf dist", "prepack": "npm run build", "pretest": "npm run build", "preview": "node preview/serve.js", "snaptests": "TAP_SNAPSHOT=1 npm test", - "test": "tap --no-check-coverage" + "test": "tap test/*.spec.ts" }, "types": "dist/index.d.ts", - "unpkg": "dist/index.browser.js", - "version": "3.2.3" + "version": "3.0.1" } diff --git a/node_modules/badgen/tsconfig.json b/node_modules/badgen/tsconfig.json index 1b76b5b7f..d8f84418e 100644 --- a/node_modules/badgen/tsconfig.json +++ b/node_modules/badgen/tsconfig.json @@ -1,7 +1,5 @@ { "compilerOptions": { - "strict": true, - "target": "es2017", "module": "commonjs", "lib": ["esnext", "dom"], @@ -14,8 +12,7 @@ "resolveJsonModule": true, "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "include": ["src"] } diff --git a/node_modules/balanced-match/.npmignore b/node_modules/balanced-match/.npmignore new file mode 100644 index 000000000..ae5d8c36a --- /dev/null +++ b/node_modules/balanced-match/.npmignore @@ -0,0 +1,5 @@ +test +.gitignore +.travis.yml +Makefile +example.js diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md new file mode 100644 index 000000000..2cdc8e414 --- /dev/null +++ b/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/balanced-match/README.md b/node_modules/balanced-match/README.md new file mode 100644 index 000000000..08e918c0d --- /dev/null +++ b/node_modules/balanced-match/README.md @@ -0,0 +1,91 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/balanced-match/index.js b/node_modules/balanced-match/index.js new file mode 100644 index 000000000..1685a7629 --- /dev/null +++ b/node_modules/balanced-match/index.js @@ -0,0 +1,59 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json new file mode 100644 index 000000000..49869f4f7 --- /dev/null +++ b/node_modules/balanced-match/package.json @@ -0,0 +1,77 @@ +{ + "_from": "balanced-match@^1.0.0", + "_id": "balanced-match@1.0.0", + "_inBundle": false, + "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "_location": "/balanced-match", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "balanced-match@^1.0.0", + "name": "balanced-match", + "escapedName": "balanced-match", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/brace-expansion" + ], + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767", + "_spec": "balanced-match@^1.0.0", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\brace-expansion", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "license": "MIT", + "main": "index.js", + "name": "balanced-match", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "scripts": { + "bench": "make bench", + "test": "make test" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.0.0" +} diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE new file mode 100644 index 000000000..de3226673 --- /dev/null +++ b/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/README.md b/node_modules/brace-expansion/README.md new file mode 100644 index 000000000..6b4e0e164 --- /dev/null +++ b/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js new file mode 100644 index 000000000..0478be81e --- /dev/null +++ b/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json new file mode 100644 index 000000000..d86159368 --- /dev/null +++ b/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "_from": "brace-expansion@^1.1.7", + "_id": "brace-expansion@1.1.11", + "_inBundle": false, + "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "_location": "/brace-expansion", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "brace-expansion@^1.1.7", + "name": "brace-expansion", + "escapedName": "brace-expansion", + "rawSpec": "^1.1.7", + "saveSpec": null, + "fetchSpec": "^1.1.7" + }, + "_requiredBy": [ + "/minimatch" + ], + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd", + "_spec": "brace-expansion@^1.1.7", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\minimatch", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "bundleDependencies": false, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "deprecated": false, + "description": "Brace expansion as known from sh/bash", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "brace-expansion", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "scripts": { + "bench": "matcha test/perf/bench.js", + "gentest": "bash test/generate.sh", + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.1.11" +} diff --git a/node_modules/concat-map/.travis.yml b/node_modules/concat-map/.travis.yml new file mode 100644 index 000000000..f1d0f13c8 --- /dev/null +++ b/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/concat-map/LICENSE b/node_modules/concat-map/LICENSE new file mode 100644 index 000000000..ee27ba4b4 --- /dev/null +++ b/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/concat-map/README.markdown b/node_modules/concat-map/README.markdown new file mode 100644 index 000000000..408f70a1b --- /dev/null +++ b/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/node_modules/concat-map/example/map.js b/node_modules/concat-map/example/map.js new file mode 100644 index 000000000..33656217b --- /dev/null +++ b/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/node_modules/concat-map/index.js b/node_modules/concat-map/index.js new file mode 100644 index 000000000..b29a7812e --- /dev/null +++ b/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/node_modules/concat-map/package.json b/node_modules/concat-map/package.json new file mode 100644 index 000000000..383a72d8a --- /dev/null +++ b/node_modules/concat-map/package.json @@ -0,0 +1,88 @@ +{ + "_from": "concat-map@0.0.1", + "_id": "concat-map@0.0.1", + "_inBundle": false, + "_integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "_location": "/concat-map", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "concat-map@0.0.1", + "name": "concat-map", + "escapedName": "concat-map", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/brace-expansion" + ], + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "_spec": "concat-map@0.0.1", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\brace-expansion", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "concatenative mapdashery", + "devDependencies": { + "tape": "~2.4.0" + }, + "directories": { + "example": "example", + "test": "test" + }, + "homepage": "https://github.com/substack/node-concat-map#readme", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "license": "MIT", + "main": "index.js", + "name": "concat-map", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "scripts": { + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "version": "0.0.1" +} diff --git a/node_modules/concat-map/test/map.js b/node_modules/concat-map/test/map.js new file mode 100644 index 000000000..fdbd7022f --- /dev/null +++ b/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/node_modules/fs.realpath/LICENSE b/node_modules/fs.realpath/LICENSE new file mode 100644 index 000000000..5bd884c25 --- /dev/null +++ b/node_modules/fs.realpath/LICENSE @@ -0,0 +1,43 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +---- + +This library bundles a version of the `fs.realpath` and `fs.realpathSync` +methods from Node.js v0.10 under the terms of the Node.js MIT license. + +Node's license follows, also included at the header of `old.js` which contains +the licensed code: + + Copyright Joyent, Inc. and other Node contributors. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. diff --git a/node_modules/fs.realpath/README.md b/node_modules/fs.realpath/README.md new file mode 100644 index 000000000..a42ceac62 --- /dev/null +++ b/node_modules/fs.realpath/README.md @@ -0,0 +1,33 @@ +# fs.realpath + +A backwards-compatible fs.realpath for Node v6 and above + +In Node v6, the JavaScript implementation of fs.realpath was replaced +with a faster (but less resilient) native implementation. That raises +new and platform-specific errors and cannot handle long or excessively +symlink-looping paths. + +This module handles those cases by detecting the new errors and +falling back to the JavaScript implementation. On versions of Node +prior to v6, it has no effect. + +## USAGE + +```js +var rp = require('fs.realpath') + +// async version +rp.realpath(someLongAndLoopingPath, function (er, real) { + // the ELOOP was handled, but it was a bit slower +}) + +// sync version +var real = rp.realpathSync(someLongAndLoopingPath) + +// monkeypatch at your own risk! +// This replaces the fs.realpath/fs.realpathSync builtins +rp.monkeypatch() + +// un-do the monkeypatching +rp.unmonkeypatch() +``` diff --git a/node_modules/fs.realpath/index.js b/node_modules/fs.realpath/index.js new file mode 100644 index 000000000..b09c7c7e6 --- /dev/null +++ b/node_modules/fs.realpath/index.js @@ -0,0 +1,66 @@ +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch + +var fs = require('fs') +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = require('./old.js') + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} + +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} + +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} diff --git a/node_modules/fs.realpath/old.js b/node_modules/fs.realpath/old.js new file mode 100644 index 000000000..b40305e73 --- /dev/null +++ b/node_modules/fs.realpath/old.js @@ -0,0 +1,303 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var pathModule = require('path'); +var isWindows = process.platform === 'win32'; +var fs = require('fs'); + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; + + return callback; + + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } +} + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} + +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} + +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } + + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } + + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + + if (cache) cache[original] = p; + + return p; +}; + + +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } + + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } + + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } + + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } + + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); + + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + + function gotTarget(err, target, base) { + if (err) return cb(err); + + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; diff --git a/node_modules/fs.realpath/package.json b/node_modules/fs.realpath/package.json new file mode 100644 index 000000000..701a5805c --- /dev/null +++ b/node_modules/fs.realpath/package.json @@ -0,0 +1,59 @@ +{ + "_from": "fs.realpath@^1.0.0", + "_id": "fs.realpath@1.0.0", + "_inBundle": false, + "_integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "_location": "/fs.realpath", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "fs.realpath@^1.0.0", + "name": "fs.realpath", + "escapedName": "fs.realpath", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "_shasum": "1504ad2523158caa40db4a2787cb01411994ea4f", + "_spec": "fs.realpath@^1.0.0", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/fs.realpath/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", + "devDependencies": {}, + "files": [ + "old.js", + "index.js" + ], + "homepage": "https://github.com/isaacs/fs.realpath#readme", + "keywords": [ + "realpath", + "fs", + "polyfill" + ], + "license": "ISC", + "main": "index.js", + "name": "fs.realpath", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/fs.realpath.git" + }, + "scripts": { + "test": "tap test/*.js --cov" + }, + "version": "1.0.0" +} diff --git a/node_modules/glob-gitignore/HISTORY.md b/node_modules/glob-gitignore/HISTORY.md new file mode 100644 index 000000000..e061a5372 --- /dev/null +++ b/node_modules/glob-gitignore/HISTORY.md @@ -0,0 +1 @@ +# History diff --git a/node_modules/glob-gitignore/LICENSE b/node_modules/glob-gitignore/LICENSE new file mode 100644 index 000000000..a346b71e9 --- /dev/null +++ b/node_modules/glob-gitignore/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2013 kaelzhang , contributors +http://kael.me/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/glob-gitignore/README.md b/node_modules/glob-gitignore/README.md new file mode 100644 index 000000000..92147bc3d --- /dev/null +++ b/node_modules/glob-gitignore/README.md @@ -0,0 +1,121 @@ +[![Build Status](https://travis-ci.org/kaelzhang/node-glob-gitignore.svg?branch=master)](https://travis-ci.org/kaelzhang/node-glob-gitignore) + + + + + +# glob-gitignore + +Extends [`glob`](https://www.npmjs.com/package/glob) with support for filtering files according to gitignore rules and exposes an optional Promise API, based on [`node-ignore`](https://www.npmjs.com/package/ignore). + +This module is built to solve performance issues, see [Why](#why). + +## Install + +```sh +$ npm i glob-gitignore --save +``` + +## Usage + +```js +import { + glob, + sync, + hasMagic +} from 'glob-gitignore' + +// The usage of glob-gitignore is much the same as `node-glob`, +// and it supports an array of patterns to be matched +glob(['**'], { + cwd: '/path/to', + + // Except that options.ignore accepts an array of gitignore rules, + // or a gitignore rule, + // or an `ignore` instance. + ignore: '*.bak' +}) +// And glob-gitignore returns a promise +.then(files => { + console.log(files) +}) + +// A string of pattern is also supported. +glob('**', options) + +// To glob things synchronously, use `sync` +const files = sync('**', {ignore: '*.bak'}) + +hasMagic('a/{b/c,x/y}') // true +``` + +## Why + +1. The `options.ignore` of `node-glob` does not support gitignore rules. + +2. It is better **NOT** to glob things then filter them by gitignore rules. Because by doing this, there will be so much unnecessary harddisk traversing, and cause performance issues, especially if there are tremendous files and directories inside the working directory. For the situation, you'd better to use this module. + +`glob-gitignore` does the filtering at the very process of each decending down. + +## glob(patterns, options) + +Returns a `Promise` + +- **patterns** `String|Array.` The pattern or array of patterns to be matched. + +And negative patterns (each of which starts with an `!`) are supported, although negative patterns are **NOT** recommended. You'd better to use `options.ignore`. + +```js +glob(['*.js', 'a/**', '!a/**/*.png']).then(console.log) +``` + +- **options** `Object` the [glob options](https://www.npmjs.com/package/glob#options) except for `options.ignore` + +### `options.ignore` + +Could be a `String`, an array of `String`s, or an instance of [node-`ignore`](https://www.npmjs.com/package/ignore) + +Not setting this is kind of silly, since that's the whole purpose of this lib, but it is optional though. + +```js +glob('**', {ignore: '*.js'}) +glob('**', {ignore: ['*.css', '*.styl']}) + +import ignore from 'ignore' +glob('**', { + ignore: ignore().add('*.js') +}) +``` + +## sync(patterns, options) + +The synchronous globber, which returns an `Array.`. + +## hasMagic(patterns, [options]) + +This method extends `glob.hasMagic(pattern)` and supports an array of patterns. + +Returns + +- `true` if there are any special characters in the pattern, or there is any of a pattern in the array has special characters. +- `false` otherwise. + +```js +hasMagic('a/{b/c,x/y}') // true +hasMagic(['a/{b/c,x/y}', 'a']) // true +hasMagic(['a']) // false +``` + +Note that the options affect the results. If `noext:true` is set in the options object, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` then that is considered magical, unless `nobrace:true` is set in the options. + +## License + +MIT diff --git a/node_modules/glob-gitignore/package.json b/node_modules/glob-gitignore/package.json new file mode 100644 index 000000000..9aae07a88 --- /dev/null +++ b/node_modules/glob-gitignore/package.json @@ -0,0 +1,85 @@ +{ + "_from": "glob-gitignore", + "_id": "glob-gitignore@1.0.14", + "_inBundle": false, + "_integrity": "sha512-YuAEPqL58bOQDqDF2kMv009rIjSAtPs+WPzyGbwRWK+wD0UWQVRoP34Pz6yJ6ivco65C9tZnaIt0I3JCuQ8NZQ==", + "_location": "/glob-gitignore", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "glob-gitignore", + "name": "glob-gitignore", + "escapedName": "glob-gitignore", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/glob-gitignore/-/glob-gitignore-1.0.14.tgz", + "_shasum": "8b708cb029e73bd388d22f7f935213aa93a1e7c2", + "_spec": "glob-gitignore", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge", + "author": { + "name": "kaelzhang" + }, + "ava": { + "babel": false + }, + "bugs": { + "url": "https://github.com/kaelzhang/node-glob-gitignore/issues" + }, + "bundleDependencies": false, + "dependencies": { + "glob": "^7.1.3", + "ignore": "^5.0.5", + "lodash.difference": "^4.5.0", + "lodash.union": "^4.6.0", + "make-array": "^1.0.5", + "util.inherits": "^1.0.3" + }, + "deprecated": false, + "description": "Extends `glob` with support for filtering files according to gitignore rules and exposes an optional Promise API with NO performance issues", + "devDependencies": { + "ava": "^1.2.1", + "codecov": "^3.2.0", + "eslint": "^5.14.1", + "eslint-config-ostai": "^1.4.0", + "eslint-plugin-import": "^2.16.0", + "nyc": "^13.3.0" + }, + "engines": { + "node": ">= 6" + }, + "files": [ + "src/" + ], + "homepage": "https://github.com/kaelzhang/node-glob-gitignore#readme", + "keywords": [ + "glob-gitignore", + "glob", + "gitignore", + "ignore", + "globby", + "promise", + "module", + "es-module" + ], + "license": "MIT", + "main": "src/index.js", + "name": "glob-gitignore", + "repository": { + "type": "git", + "url": "git://github.com/kaelzhang/node-glob-gitignore.git" + }, + "scripts": { + "lint": "eslint .", + "posttest": "nyc report --reporter=text-lcov > coverage.lcov && codecov", + "test": "nyc ava --timeout=10s", + "test-no-report": "NODE_DEBUG=ignore-nested nyc ava --timeout=10s --verbose" + }, + "version": "1.0.14" +} diff --git a/node_modules/glob-gitignore/src/glob.js b/node_modules/glob-gitignore/src/glob.js new file mode 100644 index 000000000..19b7d05a3 --- /dev/null +++ b/node_modules/glob-gitignore/src/glob.js @@ -0,0 +1,68 @@ +const {Glob} = require('glob') +const inherits = require('util.inherits') +const { + IGNORE, + createTasks +} = require('./util') +const {sync} = require('./sync') + +// Subclass of `glob.GlobSync` +// @param {string} pattern Pattern to be matched. +// @param {Object} options `options` for `glob` +// @param {function()} shouldIgnore Method to check whether a directory should be ignored. +// @constructor +function _Glob (pattern, options, callback, shouldIgnore) { + // We don't put this thing to argument `options` to avoid + // further problems, such as `options` validation. + + // Use `Symbol` as much as possible to avoid confliction. + this[IGNORE] = shouldIgnore + Glob.call(this, pattern, options, callback) +} + +inherits(_Glob, Glob) + +_Glob.prototype._readdir = function _readdir (abs, inGlobStar, cb) { + const marked = this._mark(abs) + + if (this[IGNORE] && this[IGNORE](marked)) { + return cb() + } + + return Glob.prototype._readdir.call(this, abs, inGlobStar, cb) +} + +function globOne (pattern, opts, ignore) { + return new Promise((resolve, reject) => { + new _Glob(pattern, opts, (err, files) => { + if (err) { + return reject(err) + } + + resolve(files) + }, ignore) + }) +} + +exports.glob = (_patterns, options = {}) => { + if (options.sync) { + return sync(_patterns, options) + } + + const { + patterns, + ignores, + join, + opts, + result + } = createTasks(_patterns, options) + + if (result) { + return Promise.resolve(result) + } + + return Promise.all( + patterns.map(pattern => globOne(pattern, opts, ignores)) + ) + .then(join) +} diff --git a/node_modules/glob-gitignore/src/index.js b/node_modules/glob-gitignore/src/index.js new file mode 100644 index 000000000..b628ba5f7 --- /dev/null +++ b/node_modules/glob-gitignore/src/index.js @@ -0,0 +1,15 @@ +const make_array = require('make-array') +const vanilla = require('glob') + +const {sync} = require('./sync') +const {glob} = require('./glob') + +const hasMagic = (patterns, options) => + make_array(patterns) + .some(pattern => vanilla.hasMagic(pattern, options)) + +module.exports = { + sync, + glob, + hasMagic +} diff --git a/node_modules/glob-gitignore/src/sync.js b/node_modules/glob-gitignore/src/sync.js new file mode 100644 index 000000000..f77cee37a --- /dev/null +++ b/node_modules/glob-gitignore/src/sync.js @@ -0,0 +1,50 @@ +const {GlobSync} = require('glob') +const inherits = require('util.inherits') +const { + IGNORE, + createTasks +} = require('./util') + +function _GlobSync (pattern, options, shouldIgnore) { + this[IGNORE] = shouldIgnore + GlobSync.call(this, pattern, options) +} + +inherits(_GlobSync, GlobSync) + +_GlobSync.prototype._readdir = function _readdir (abs, inGlobStar) { + // `options.nodir` makes `options.mark` as `true`. + // Mark `abs` first + // to make sure `'node_modules'` will be ignored immediately + // with ignore pattern `'node_modules/'`. + + // There is a built-in cache about marked `File.Stat` in `glob`, + // so that we could not worry about the extra invocation of `this._mark()` + const marked = this._mark(abs) + + if (this[IGNORE] && this[IGNORE](marked)) { + return null + } + + return GlobSync.prototype._readdir.call(this, abs, inGlobStar) +} + +exports.sync = (_patterns, options = {}) => { + const { + join, + patterns, + ignores, + opts, + result + } = createTasks(_patterns, options) + + if (result) { + return result + } + + const groups = patterns.map( + pattern => new _GlobSync(pattern, opts, ignores).found + ) + + return join(groups) +} diff --git a/node_modules/glob-gitignore/src/util.js b/node_modules/glob-gitignore/src/util.js new file mode 100644 index 000000000..a14e200ce --- /dev/null +++ b/node_modules/glob-gitignore/src/util.js @@ -0,0 +1,137 @@ +const ignore = require('ignore') +const path = require('path') +const difference = require('lodash.difference') +const union = require('lodash.union') +const make_array = require('make-array') + +const IGNORE = typeof Symbol === 'function' + ? Symbol('ignore') + : '_shouldIgnore' + +const relative = (abs, cwd) => path.relative(cwd, abs) + +const createShouldIgnore = options => { + const opts = Object.assign({ + cache: Object.create(null), + statCache: Object.create(null), + realpathCache: Object.create(null), + symlinks: Object.create(null) + }, options) + + const { + ignore: ignores, + cwd = process.cwd() + } = opts + + delete opts.ignore + + if (!ignores) { + return { + ignore: () => false, + filter: () => true, + opts + } + } + + const ig = ignore().add(ignores) + const _filter = ig.createFilter() + + const filterABS = f => { + const filepath = relative(f, cwd) + if (!filepath) { + return true + } + + return _filter(filepath) + } + + const filter = options.absolute + ? filterABS + : _filter + + return { + // Check directories during traversing + ignores: f => !filterABS(f), + // Filter result + filter, + opts + } +} + +const isNegative = pattern => pattern[0] === '!' +const isPattern = subject => subject && typeof subject === 'string' + +const createTasks = (patterns, options) => { + patterns = make_array(patterns) + + if (!patterns.length || !patterns.every(isPattern)) { + throw new TypeError('patterns must be a string or an array of strings') + } + + const negativeFlags = [] + let positivesCount = 0 + patterns = patterns.map((pattern, i) => { + if (isNegative(pattern)) { + negativeFlags[i] = true + return pattern.slice(1) + } + + positivesCount ++ + return pattern + }) + + // or only provide a negative pattern + if (positivesCount === 0) { + return { + result: [] + } + } + + const { + opts, + filter, + ignores + } = createShouldIgnore(options) + + // Only one positive pattern + if (positivesCount === 1) { + return { + join ([files]) { + // _GlobSync only filters _readdir, + // so glob results should be filtered again. + return files.filter(filter) + }, + + patterns, + opts, + ignores + } + } + + return { + join (fileGroups) { + const positives = [] + const negatives = [] + + fileGroups.forEach((files, i) => { + /* eslint no-unused-expressions: 'off' */ + negativeFlags[i] + ? negatives.push(files) + : positives.push(files) + }) + + return difference(union(...positives), ...negatives) + // The same reason as above + .filter(filter) + }, + + patterns, + opts, + ignore + } +} + +module.exports = { + IGNORE, + createTasks +} diff --git a/node_modules/glob/LICENSE b/node_modules/glob/LICENSE new file mode 100644 index 000000000..42ca266df --- /dev/null +++ b/node_modules/glob/LICENSE @@ -0,0 +1,21 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +## Glob Logo + +Glob's logo created by Tanya Brassie , licensed +under a Creative Commons Attribution-ShareAlike 4.0 International License +https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/node_modules/glob/README.md b/node_modules/glob/README.md new file mode 100644 index 000000000..0916a4825 --- /dev/null +++ b/node_modules/glob/README.md @@ -0,0 +1,375 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Glob Logo +Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` + +![](oh-my-glob.gif) diff --git a/node_modules/glob/changelog.md b/node_modules/glob/changelog.md new file mode 100644 index 000000000..41636771e --- /dev/null +++ b/node_modules/glob/changelog.md @@ -0,0 +1,67 @@ +## 7.0 + +- Raise error if `options.cwd` is specified, and not a directory + +## 6.0 + +- Remove comment and negation pattern support +- Ignore patterns are always in `dot:true` mode + +## 5.0 + +- Deprecate comment and negation patterns +- Fix regression in `mark` and `nodir` options from making all cache + keys absolute path. +- Abort if `fs.readdir` returns an error that's unexpected +- Don't emit `match` events for ignored items +- Treat ENOTSUP like ENOTDIR in readdir + +## 4.5 + +- Add `options.follow` to always follow directory symlinks in globstar +- Add `options.realpath` to call `fs.realpath` on all results +- Always cache based on absolute path + +## 4.4 + +- Add `options.ignore` +- Fix handling of broken symlinks + +## 4.3 + +- Bump minimatch to 2.x +- Pass all tests on Windows + +## 4.2 + +- Add `glob.hasMagic` function +- Add `options.nodir` flag + +## 4.1 + +- Refactor sync and async implementations for performance +- Throw if callback provided to sync glob function +- Treat symbolic links in globstar results the same as Bash 4.3 + +## 4.0 + +- Use `^` for dependency versions (bumped major because this breaks + older npm versions) +- Ensure callbacks are only ever called once +- switch to ISC license + +## 3.x + +- Rewrite in JavaScript +- Add support for setting root, cwd, and windows support +- Cache many fs calls +- Add globstar support +- emit match events + +## 2.x + +- Use `glob.h` and `fnmatch.h` from NetBSD + +## 1.x + +- `glob.h` static binding. diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js new file mode 100644 index 000000000..66651bb3a --- /dev/null +++ b/node_modules/glob/common.js @@ -0,0 +1,240 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js new file mode 100644 index 000000000..58dec0f6c --- /dev/null +++ b/node_modules/glob/glob.js @@ -0,0 +1,790 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json new file mode 100644 index 000000000..42043282c --- /dev/null +++ b/node_modules/glob/package.json @@ -0,0 +1,80 @@ +{ + "_from": "glob", + "_id": "glob@7.1.6", + "_inBundle": false, + "_integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "_location": "/glob", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "glob", + "name": "glob", + "escapedName": "glob", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "_shasum": "141f33b81a7c2492e125594307480c46679278a6", + "_spec": "glob", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" + }, + "bundleDependencies": false, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "deprecated": false, + "description": "a little globber", + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^12.0.1", + "tick": "0.0.6" + }, + "engines": { + "node": "*" + }, + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "homepage": "https://github.com/isaacs/node-glob#readme", + "license": "ISC", + "main": "glob.js", + "name": "glob", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "scripts": { + "bench": "bash benchmark.sh", + "benchclean": "node benchclean.js", + "prepublish": "npm run benchclean", + "prof": "bash prof.sh && cat profile.txt", + "profclean": "rm -f v8.log profile.txt", + "test": "tap test/*.js --cov", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" + }, + "version": "7.1.6" +} diff --git a/node_modules/glob/sync.js b/node_modules/glob/sync.js new file mode 100644 index 000000000..c952134ba --- /dev/null +++ b/node_modules/glob/sync.js @@ -0,0 +1,486 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs + } + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/node_modules/ignore/CHANGELOG.md b/node_modules/ignore/CHANGELOG.md new file mode 100644 index 000000000..dc38d633a --- /dev/null +++ b/node_modules/ignore/CHANGELOG.md @@ -0,0 +1,32 @@ +# `node-ignore` 5 ChangeLog + +# 5.x + +## 2018-08-14, Version 5.0.1 + +- **PATCH**: fixes for windows. +- **PATCH**: improves tests for typescript and windows. + +## 2018-08-13, Version 5.0.0 + +- **SEMVER-MAJOR**: [#20](https://github.com/kaelzhang/node-ignore/issues/20): it will throw if an invalid pathname passes into `.ignores(pathname)`, see [Upgrade 4.x -> 5.x](https://github.com/kaelzhang/node-ignore#upgrade-4x---5x). +- **FEATURE**: [#31](https://github.com/kaelzhang/node-ignore/issues/31): adds a new method [`.test(pathname)`](https://github.com/kaelzhang/node-ignore#testpathname-pathname-since-500). +- **BENCHMARK**: improves performance by 26%. + +# 4.x + +## 2018-08-12, Version 4.0.6 + +- **PATCH**: `Object.prototype` methods will not ruin the result any more. + +## ~ 2018-08-09, Version 4.0.1 - 4.0.5 + +- **PATCH**: updates README.md about frequent asked quesions from github issues. + +## 2018-06-22, Version 4.0.0 + +- **SEMVER-MAJOR**: Drop support for node < 6 by default. +- **FEATURE**: supports the missing character ranges and sets, such as `*.[a-z]` and `*.[jJ][pP][gG]` +- **FEATURE**: new option: `ignorecase` to make `ignore` case insensitive. +- **FEATURE**: supports question mark which matches a single character. +- **PATCH**: fixes typescript declaration. diff --git a/node_modules/ignore/LICENSE-MIT b/node_modules/ignore/LICENSE-MIT new file mode 100644 index 000000000..825533e33 --- /dev/null +++ b/node_modules/ignore/LICENSE-MIT @@ -0,0 +1,21 @@ +Copyright (c) 2013 Kael Zhang , contributors +http://kael.me/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/ignore/README.md b/node_modules/ignore/README.md new file mode 100644 index 000000000..c52b32519 --- /dev/null +++ b/node_modules/ignore/README.md @@ -0,0 +1,386 @@ + + + + + + + + + + + + + +
LinuxOS XWindowsCoverageDownloads
+ + Build Status + + + Windows Build Status + + + Coverage Status + + + npm module downloads per month +
+ +# ignore + +`ignore` is a manager, filter and parser which implemented in pure JavaScript according to the .gitignore [spec](http://git-scm.com/docs/gitignore). + +`ignore` is used by eslint, gitbook and [many others](https://www.npmjs.com/browse/depended/ignore). + +Pay attention that [`minimatch`](https://www.npmjs.org/package/minimatch) does not work in the gitignore way. To filter filenames according to .gitignore file, I recommend this module. + +### Tested on + +`ignore` is fully tested, and has more than **five hundreds** of unit tests. + +- Linux + Node: `0.8` - `7.x` +- Windows + Node: `0.10` - `7.x`, node < `0.10` is not tested due to the lack of support of appveyor. + +Actually, `ignore` does not rely on any versions of node specially. + +Since `4.0.0`, ignore will no longer support `node < 6` by default, to use in node < 6, `require('ignore/legacy')`. For details, see [CHANGELOG](https://github.com/kaelzhang/node-ignore/blob/master/CHANGELOG.md). + +## Table Of Main Contents + +- [Usage](#usage) +- [`Pathname` Conventions](#pathname-conventions) +- See Also: + - [`glob-gitignore`](https://www.npmjs.com/package/glob-gitignore) matches files using patterns and filters them according to gitignore rules. +- [Upgrade Guide](#upgrade-guide) + +## Install + +```sh +npm i ignore +``` + +## Usage + +```js +import ignore from 'ignore' +const ig = ignore().add(['.abc/*', '!.abc/d/']) +``` + +### Filter the given paths + +```js +const paths = [ + '.abc/a.js', // filtered out + '.abc/d/e.js' // included +] + +ig.filter(paths) // ['.abc/d/e.js'] +ig.ignores('.abc/a.js') // true +``` + +### As the filter function + +```js +paths.filter(ig.createFilter()); // ['.abc/d/e.js'] +``` + +### Win32 paths will be handled + +```js +ig.filter(['.abc\\a.js', '.abc\\d\\e.js']) +// if the code above runs on windows, the result will be +// ['.abc\\d\\e.js'] +``` + +## Why another ignore? + +- `ignore` is a standalone module, and is much simpler so that it could easy work with other programs, unlike [isaacs](https://npmjs.org/~isaacs)'s [fstream-ignore](https://npmjs.org/package/fstream-ignore) which must work with the modules of the fstream family. + +- `ignore` only contains utility methods to filter paths according to the specified ignore rules, so + - `ignore` never try to find out ignore rules by traversing directories or fetching from git configurations. + - `ignore` don't cares about sub-modules of git projects. + +- Exactly according to [gitignore man page](http://git-scm.com/docs/gitignore), fixes some known matching issues of fstream-ignore, such as: + - '`/*.js`' should only match '`a.js`', but not '`abc/a.js`'. + - '`**/foo`' should match '`foo`' anywhere. + - Prevent re-including a file if a parent directory of that file is excluded. + - Handle trailing whitespaces: + - `'a '`(one space) should not match `'a '`(two spaces). + - `'a \ '` matches `'a '` + - All test cases are verified with the result of `git check-ignore`. + +# Methods + +## .add(pattern: string | Ignore): this +## .add(patterns: Array): this + +- **pattern** `String | Ignore` An ignore pattern string, or the `Ignore` instance +- **patterns** `Array` Array of ignore patterns. + +Adds a rule or several rules to the current manager. + +Returns `this` + +Notice that a line starting with `'#'`(hash) is treated as a comment. Put a backslash (`'\'`) in front of the first hash for patterns that begin with a hash, if you want to ignore a file with a hash at the beginning of the filename. + +```js +ignore().add('#abc').ignores('#abc') // false +ignore().add('\#abc').ignores('#abc') // true +``` + +`pattern` could either be a line of ignore pattern or a string of multiple ignore patterns, which means we could just `ignore().add()` the content of a ignore file: + +```js +ignore() +.add(fs.readFileSync(filenameOfGitignore).toString()) +.filter(filenames) +``` + +`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance. + +## .addIgnoreFile(path) + +REMOVED in `3.x` for now. + +To upgrade `ignore@2.x` up to `3.x`, use + +```js +import fs from 'fs' + +if (fs.existsSync(filename)) { + ignore().add(fs.readFileSync(filename).toString()) +} +``` + +instead. + +## .filter(paths: Array<Pathname>): Array<Pathname> + +```ts +type Pathname = string +``` + +Filters the given array of pathnames, and returns the filtered array. + +- **paths** `Array.` The array of `pathname`s to be filtered. + +### `Pathname` Conventions: + +#### 1. `Pathname` should be a `path.relative()`d pathname + +`Pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory, + +```js +// WRONG, an error will be thrown +ig.ignores('./abc') + +// WRONG, for it will never happen, and an error will be thrown +// If the gitignore rule locates at the root directory, +// `'/abc'` should be changed to `'abc'`. +// ``` +// path.relative('/', '/abc') -> 'abc' +// ``` +ig.ignores('/abc') + +// WRONG, that it is an absolute path on Windows, an error will be thrown +ig.ignores('C:\\abc') + +// Right +ig.ignores('abc') + +// Right +ig.ignores(path.join('./abc')) // path.join('./abc') -> 'abc' +``` + +In other words, each `Pathname` here should be a relative path to the directory of the gitignore rules. + +Suppose the dir structure is: + +``` +/path/to/your/repo + |-- a + | |-- a.js + | + |-- .b + | + |-- .c + |-- .DS_store +``` + +Then the `paths` might be like this: + +```js +[ + 'a/a.js' + '.b', + '.c/.DS_store' +] +``` + +#### 2. filenames and dirnames + +`node-ignore` does NO `fs.stat` during path matching, so for the example below: + +```js +// First, we add a ignore pattern to ignore a directory +ig.add('config/') + +// `ig` does NOT know if 'config', in the real world, +// is a normal file, directory or something. + +ig.ignores('config') +// `ig` treats `config` as a file, so it returns `false` + +ig.ignores('config/') +// returns `true` +``` + +Specially for people who develop some library based on `node-ignore`, it is important to understand that. + +Usually, you could use [`glob`](http://npmjs.org/package/glob) with `option.mark = true` to fetch the structure of the current directory: + +```js +import glob from 'glob' + +glob('**', { + // Adds a / character to directory matches. + mark: true +}, (err, files) => { + if (err) { + return console.error(err) + } + + let filtered = ignore().add(patterns).filter(files) + console.log(filtered) +}) +``` + +## .ignores(pathname: Pathname): boolean + +> new in 3.2.0 + +Returns `Boolean` whether `pathname` should be ignored. + +```js +ig.ignores('.abc/a.js') // true +``` + +## .createFilter() + +Creates a filter function which could filter an array of paths with `Array.prototype.filter`. + +Returns `function(path)` the filter function. + +## .test(pathname: Pathname) since 5.0.0 + +Returns `TestResult` + +```ts +interface TestResult { + ignored: boolean + // true if the `pathname` is finally unignored by some negative pattern + unignored: boolean +} +``` + +- `{ignored: true, unignored: false}`: the `pathname` is ignored +- `{ignored: false, unignored: true}`: the `pathname` is unignored +- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules. + +## `options.ignorecase` since 4.0.0 + +Similar as the `core.ignorecase` option of [git-config](https://git-scm.com/docs/git-config), `node-ignore` will be case insensitive if `options.ignorecase` is set to `true` (the default value), otherwise case sensitive. + +```js +const ig = ignore({ + ignorecase: false +}) + +ig.add('*.png') + +ig.ignores('*.PNG') // false +``` + +## static `ignore.isPathValid(pathname): boolean` since 5.0.0 + +Check whether the `pathname` is valid according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname). + +```js +ignore.isPathValid('./foo') // false +``` + +**** + +# Upgrade Guide + +## Upgrade 4.x -> 5.x + +Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, while `ignore < 5.0.0` did not make sure what the return value was, as well as + +```ts +.ignores(pathname: Pathname): boolean + +.filter(pathnames: Array): Array + +.createFilter(): (pathname: Pathname) => boolean + +.test(pathname: Pathname): {ignored: boolean, unignored: boolean} +``` + +See the convention [here](#1-pathname-should-be-a-pathrelatived-pathname) for details. + +If there are invalid pathnames, the conversion and filtration should be done by users. + +```js +import {isPathValid} from 'ignore' // introduced in 5.0.0 + +const paths = [ + // invalid + ////////////////// + '', + false, + '../foo', + '.', + ////////////////// + + // valid + 'foo' +] +.filter(isValidPath) + +ig.filter(paths) +``` + +## Upgrade 3.x -> 4.x + +Since `4.0.0`, `ignore` will no longer support node < 6, to use `ignore` in node < 6: + +```js +var ignore = require('ignore/legacy') +``` + +## Upgrade 2.x -> 3.x + +- All `options` of 2.x are unnecessary and removed, so just remove them. +- `ignore()` instance is no longer an [`EventEmitter`](nodejs.org/api/events.html), and all events are unnecessary and removed. +- `.addIgnoreFile()` is removed, see the [.addIgnoreFile](#addignorefilepath) section for details. + +**** + +# Collaborators + +- [@whitecolor](https://github.com/whitecolor) *Alex* +- [@SamyPesse](https://github.com/SamyPesse) *Samy Pessé* +- [@azproduction](https://github.com/azproduction) *Mikhail Davydov* +- [@TrySound](https://github.com/TrySound) *Bogdan Chadkin* +- [@JanMattner](https://github.com/JanMattner) *Jan Mattner* +- [@ntwb](https://github.com/ntwb) *Stephen Edgar* +- [@kasperisager](https://github.com/kasperisager) *Kasper Isager* +- [@sandersn](https://github.com/sandersn) *Nathan Shively-Sanders* diff --git a/node_modules/ignore/index.d.ts b/node_modules/ignore/index.d.ts new file mode 100644 index 000000000..66657af5e --- /dev/null +++ b/node_modules/ignore/index.d.ts @@ -0,0 +1,63 @@ +type Pathname = string + +interface TestResult { + ignored: boolean + unignored: boolean +} + +export interface Ignore { + /** + * Adds a rule rules to the current manager. + * @param {string | Ignore} pattern + * @returns IgnoreBase + */ + add(pattern: string | Ignore): this + /** + * Adds several rules to the current manager. + * @param {string[]} patterns + * @returns IgnoreBase + */ + add(patterns: (string | Ignore)[]): this + + /** + * Filters the given array of pathnames, and returns the filtered array. + * NOTICE that each path here should be a relative path to the root of your repository. + * @param paths the array of paths to be filtered. + * @returns The filtered array of paths + */ + filter(pathnames: Pathname[]): Pathname[] + /** + * Creates a filter function which could filter + * an array of paths with Array.prototype.filter. + */ + createFilter(): (pathname: Pathname) => boolean + + /** + * Returns Boolean whether pathname should be ignored. + * @param {string} pathname a path to check + * @returns boolean + */ + ignores(pathname: Pathname): boolean + + /** + * Returns whether pathname should be ignored or unignored + * @param {string} pathname a path to check + * @returns TestResult + */ + test(pathname: Pathname): TestResult +} + +interface Options { + ignorecase?: boolean +} + +/** + * Creates new ignore manager. + */ +declare function ignore(options?: Options): Ignore + +declare namespace ignore { + export function isPathValid (pathname: string): boolean +} + +export default ignore diff --git a/node_modules/ignore/index.js b/node_modules/ignore/index.js new file mode 100644 index 000000000..8ee485873 --- /dev/null +++ b/node_modules/ignore/index.js @@ -0,0 +1,568 @@ +// A simple implementation of make-array +function makeArray (subject) { + return Array.isArray(subject) + ? subject + : [subject] +} + +const REGEX_TEST_BLANK_LINE = /^\s+$/ +const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/ +const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/ +const REGEX_SPLITALL_CRLF = /\r?\n/g +// /foo, +// ./foo, +// ../foo, +// . +// .. +const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/ + +const SLASH = '/' +const KEY_IGNORE = typeof Symbol !== 'undefined' + ? Symbol.for('node-ignore') + /* istanbul ignore next */ + : 'node-ignore' + +const define = (object, key, value) => + Object.defineProperty(object, key, {value}) + +const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g + +// Sanitize the range of a regular expression +// The cases are complicated, see test cases for details +const sanitizeRange = range => range.replace( + REGEX_REGEXP_RANGE, + (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) + ? match + // Invalid range (out of order) which is ok for gitignore rules but + // fatal for JavaScript regular expression, so eliminate it. + : '' +) + +// > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` + +// '`foo/`' should not continue with the '`..`' +const REPLACERS = [ + + // > Trailing spaces are ignored unless they are quoted with backslash ("\") + [ + // (a\ ) -> (a ) + // (a ) -> (a) + // (a \ ) -> (a ) + /\\?\s+$/, + match => match.indexOf('\\') === 0 + ? ' ' + : '' + ], + + // replace (\ ) with ' ' + [ + /\\\s/g, + () => ' ' + ], + + // Escape metacharacters + // which is written down by users but means special for regular expressions. + + // > There are 12 characters with special meanings: + // > - the backslash \, + // > - the caret ^, + // > - the dollar sign $, + // > - the period or dot ., + // > - the vertical bar or pipe symbol |, + // > - the question mark ?, + // > - the asterisk or star *, + // > - the plus sign +, + // > - the opening parenthesis (, + // > - the closing parenthesis ), + // > - and the opening square bracket [, + // > - the opening curly brace {, + // > These special characters are often called "metacharacters". + [ + /[\\^$.|*+(){]/g, + match => `\\${match}` + ], + + [ + // > [abc] matches any character inside the brackets + // > (in this case a, b, or c); + /\[([^\]/]*)($|\])/g, + (match, p1, p2) => p2 === ']' + ? `[${sanitizeRange(p1)}]` + : `\\${match}` + ], + + [ + // > a question mark (?) matches a single character + /(?!\\)\?/g, + () => '[^/]' + ], + + // leading slash + [ + + // > A leading slash matches the beginning of the pathname. + // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". + // A leading slash matches the beginning of the pathname + /^\//, + () => '^' + ], + + // replace special metacharacter slash after the leading slash + [ + /\//g, + () => '\\/' + ], + + [ + // > A leading "**" followed by a slash means match in all directories. + // > For example, "**/foo" matches file or directory "foo" anywhere, + // > the same as pattern "foo". + // > "**/foo/bar" matches file or directory "bar" anywhere that is directly + // > under directory "foo". + // Notice that the '*'s have been replaced as '\\*' + /^\^*\\\*\\\*\\\//, + + // '**/foo' <-> 'foo' + () => '^(?:.*\\/)?' + ], + + // ending + [ + // 'js' will not match 'js.' + // 'ab' will not match 'abc' + /(?:[^*])$/, + + // WTF! + // https://git-scm.com/docs/gitignore + // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) + // which re-fixes #24, #38 + + // > If there is a separator at the end of the pattern then the pattern + // > will only match directories, otherwise the pattern can match both + // > files and directories. + + // 'js*' will not match 'a.js' + // 'js/' will not match 'a.js' + // 'js' will match 'a.js' and 'a.js/' + match => /\/$/.test(match) + // foo/ will not match 'foo' + ? `${match}$` + // foo matches 'foo' and 'foo/' + : `${match}(?=$|\\/$)` + ], + + // starting + [ + // there will be no leading '/' + // (which has been replaced by section "leading slash") + // If starts with '**', adding a '^' to the regular expression also works + /^(?=[^^])/, + function startingReplacer () { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) + // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' + + // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^' + } + ], + + // two globstars + [ + // Use lookahead assertions so that we could match more than one `'/**'` + /\\\/\\\*\\\*(?=\\\/|$)/g, + + // Zero, one or several directories + // should not use '*', or it will be replaced by the next replacer + + // Check if it is not the last `'/**'` + (_, index, str) => index + 6 < str.length + + // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches + // > zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' + + // case: /** + // > A trailing `"/**"` matches everything inside. + + // #21: everything inside but it should not include the current folder + : '\\/.+' + ], + + // intermediate wildcards + [ + // Never replace escaped '*' + // ignore rule '\*' will match the path '*' + + // 'abc.*/' -> go + // 'abc.*' -> skip this rule + /(^|[^\\]+)\\\*(?=.+)/g, + + // '*.js' matches '.js' + // '*.js' doesn't match 'abc' + (_, p1) => `${p1}[^\\/]*` + ], + + // trailing wildcard + [ + /(\^|\\\/)?\\\*$/, + (_, p1) => { + const prefix = p1 + // '\^': + // '/*' does not match '' + // '/*' does not match everything + + // '\\\/': + // 'abc/*' does not match 'abc/' + ? `${p1}[^/]+` + + // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*' + + return `${prefix}(?=$|\\/$)` + } + ], + + [ + // unescape + /\\\\\\/g, + () => '\\' + ] +] + +// A simple cache, because an ignore rule only has only one certain meaning +const regexCache = Object.create(null) + +// @param {pattern} +const makeRegex = (pattern, negative, ignorecase) => { + const r = regexCache[pattern] + if (r) { + return r + } + + // const replacers = negative + // ? NEGATIVE_REPLACERS + // : POSITIVE_REPLACERS + + const source = REPLACERS.reduce( + (prev, current) => prev.replace(current[0], current[1].bind(pattern)), + pattern + ) + + return regexCache[pattern] = ignorecase + ? new RegExp(source, 'i') + : new RegExp(source) +} + +const isString = subject => typeof subject === 'string' + +// > A blank line matches no files, so it can serve as a separator for readability. +const checkPattern = pattern => pattern + && isString(pattern) + && !REGEX_TEST_BLANK_LINE.test(pattern) + + // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0 + +const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF) + +class IgnoreRule { + constructor ( + origin, + pattern, + negative, + regex + ) { + this.origin = origin + this.pattern = pattern + this.negative = negative + this.regex = regex + } +} + +const createRule = (pattern, ignorecase) => { + const origin = pattern + let negative = false + + // > An optional prefix "!" which negates the pattern; + if (pattern.indexOf('!') === 0) { + negative = true + pattern = pattern.substr(1) + } + + pattern = pattern + // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') + // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#') + + const regex = makeRegex(pattern, negative, ignorecase) + + return new IgnoreRule( + origin, + pattern, + negative, + regex + ) +} + +const throwError = (message, Ctor) => { + throw new Ctor(message) +} + +const checkPath = (path, originalPath, doThrow) => { + if (!isString(path)) { + return doThrow( + `path must be a string, but got \`${originalPath}\``, + TypeError + ) + } + + // We don't know if we should ignore '', so throw + if (!path) { + return doThrow(`path must not be empty`, TypeError) + } + + // Check if it is a relative path + if (checkPath.isNotRelative(path)) { + const r = '`path.relative()`d' + return doThrow( + `path should be a ${r} string, but got "${originalPath}"`, + RangeError + ) + } + + return true +} + +const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path) + +checkPath.isNotRelative = isNotRelative +checkPath.convert = p => p + +class Ignore { + constructor ({ + ignorecase = true + } = {}) { + this._rules = [] + this._ignorecase = ignorecase + define(this, KEY_IGNORE, true) + this._initCache() + } + + _initCache () { + this._ignoreCache = Object.create(null) + this._testCache = Object.create(null) + } + + _addPattern (pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules) + this._added = true + return + } + + if (checkPattern(pattern)) { + const rule = createRule(pattern, this._ignorecase) + this._added = true + this._rules.push(rule) + } + } + + // @param {Array | string | Ignore} pattern + add (pattern) { + this._added = false + + makeArray( + isString(pattern) + ? splitPattern(pattern) + : pattern + ).forEach(this._addPattern, this) + + // Some rules have just added to the ignore, + // making the behavior changed. + if (this._added) { + this._initCache() + } + + return this + } + + // legacy + addPattern (pattern) { + return this.add(pattern) + } + + // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X + + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. + + // @returns {TestResult} true if a file is ignored + _testOne (path, checkUnignored) { + let ignored = false + let unignored = false + + this._rules.forEach(rule => { + const {negative} = rule + if ( + unignored === negative && ignored !== unignored + || negative && !ignored && !unignored && !checkUnignored + ) { + return + } + + const matched = rule.regex.test(path) + + if (matched) { + ignored = !negative + unignored = negative + } + }) + + return { + ignored, + unignored + } + } + + // @returns {TestResult} + _test (originalPath, cache, checkUnignored, slices) { + const path = originalPath + // Supports nullable path + && checkPath.convert(originalPath) + + checkPath(path, originalPath, throwError) + + return this._t(path, cache, checkUnignored, slices) + } + + _t (path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path] + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH) + } + + slices.pop() + + // If the path has no parent directory, just test it + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored) + } + + const parent = this._t( + slices.join(SLASH) + SLASH, + cache, + checkUnignored, + slices + ) + + // If the path contains a parent directory, check the parent first + return cache[path] = parent.ignored + // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent + : this._testOne(path, checkUnignored) + } + + ignores (path) { + return this._test(path, this._ignoreCache, false).ignored + } + + createFilter () { + return path => !this.ignores(path) + } + + filter (paths) { + return makeArray(paths).filter(this.createFilter()) + } + + // @returns {TestResult} + test (path) { + return this._test(path, this._testCache, true) + } +} + +const factory = options => new Ignore(options) + +const returnFalse = () => false + +const isPathValid = path => + checkPath(path && checkPath.convert(path), path, returnFalse) + +factory.isPathValid = isPathValid + +// Fixes typescript +factory.default = factory + +module.exports = factory + +// Windows +// -------------------------------------------------------------- +/* istanbul ignore if */ +if ( + // Detect `process` so that it can run in browsers. + typeof process !== 'undefined' + && ( + process.env && process.env.IGNORE_TEST_WIN32 + || process.platform === 'win32' + ) +) { + /* eslint no-control-regex: "off" */ + const makePosix = str => /^\\\\\?\\/.test(str) + || /["<>|\u0000-\u001F]+/u.test(str) + ? str + : str.replace(/\\/g, '/') + + checkPath.convert = makePosix + + // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i + checkPath.isNotRelative = path => + REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) + || isNotRelative(path) +} diff --git a/node_modules/ignore/legacy.js b/node_modules/ignore/legacy.js new file mode 100644 index 000000000..6ae2bb857 --- /dev/null +++ b/node_modules/ignore/legacy.js @@ -0,0 +1,476 @@ +"use strict"; + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +// A simple implementation of make-array +function makeArray(subject) { + return Array.isArray(subject) ? subject : [subject]; +} + +var REGEX_TEST_BLANK_LINE = /^\s+$/; +var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/; +var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/; +var REGEX_SPLITALL_CRLF = /\r?\n/g; // /foo, +// ./foo, +// ../foo, +// . +// .. + +var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/; +var SLASH = '/'; +var KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol["for"]('node-ignore') +/* istanbul ignore next */ +: 'node-ignore'; + +var define = function define(object, key, value) { + return Object.defineProperty(object, key, { + value: value + }); +}; + +var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g; // Sanitize the range of a regular expression +// The cases are complicated, see test cases for details + +var sanitizeRange = function sanitizeRange(range) { + return range.replace(REGEX_REGEXP_RANGE, function (match, from, to) { + return from.charCodeAt(0) <= to.charCodeAt(0) ? match // Invalid range (out of order) which is ok for gitignore rules but + // fatal for JavaScript regular expression, so eliminate it. + : ''; + }); +}; // > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` +// '`foo/`' should not continue with the '`..`' + + +var REPLACERS = [// > Trailing spaces are ignored unless they are quoted with backslash ("\") +[// (a\ ) -> (a ) +// (a ) -> (a) +// (a \ ) -> (a ) +/\\?\s+$/, function (match) { + return match.indexOf('\\') === 0 ? ' ' : ''; +}], // replace (\ ) with ' ' +[/\\\s/g, function () { + return ' '; +}], // Escape metacharacters +// which is written down by users but means special for regular expressions. +// > There are 12 characters with special meanings: +// > - the backslash \, +// > - the caret ^, +// > - the dollar sign $, +// > - the period or dot ., +// > - the vertical bar or pipe symbol |, +// > - the question mark ?, +// > - the asterisk or star *, +// > - the plus sign +, +// > - the opening parenthesis (, +// > - the closing parenthesis ), +// > - and the opening square bracket [, +// > - the opening curly brace {, +// > These special characters are often called "metacharacters". +[/[\\^$.|*+(){]/g, function (match) { + return "\\".concat(match); +}], [// > [abc] matches any character inside the brackets +// > (in this case a, b, or c); +/\[([^\]/]*)($|\])/g, function (match, p1, p2) { + return p2 === ']' ? "[".concat(sanitizeRange(p1), "]") : "\\".concat(match); +}], [// > a question mark (?) matches a single character +/(?!\\)\?/g, function () { + return '[^/]'; +}], // leading slash +[// > A leading slash matches the beginning of the pathname. +// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". +// A leading slash matches the beginning of the pathname +/^\//, function () { + return '^'; +}], // replace special metacharacter slash after the leading slash +[/\//g, function () { + return '\\/'; +}], [// > A leading "**" followed by a slash means match in all directories. +// > For example, "**/foo" matches file or directory "foo" anywhere, +// > the same as pattern "foo". +// > "**/foo/bar" matches file or directory "bar" anywhere that is directly +// > under directory "foo". +// Notice that the '*'s have been replaced as '\\*' +/^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo' +function () { + return '^(?:.*\\/)?'; +}], // ending +[// 'js' will not match 'js.' +// 'ab' will not match 'abc' +/(?:[^*])$/, // WTF! +// https://git-scm.com/docs/gitignore +// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) +// which re-fixes #24, #38 +// > If there is a separator at the end of the pattern then the pattern +// > will only match directories, otherwise the pattern can match both +// > files and directories. +// 'js*' will not match 'a.js' +// 'js/' will not match 'a.js' +// 'js' will match 'a.js' and 'a.js/' +function (match) { + return /\/$/.test(match) // foo/ will not match 'foo' + ? "".concat(match, "$") // foo matches 'foo' and 'foo/' + : "".concat(match, "(?=$|\\/$)"); +}], // starting +[// there will be no leading '/' +// (which has been replaced by section "leading slash") +// If starts with '**', adding a '^' to the regular expression also works +/^(?=[^^])/, function startingReplacer() { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^'; +}], // two globstars +[// Use lookahead assertions so that we could match more than one `'/**'` +/\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories +// should not use '*', or it will be replaced by the next replacer +// Check if it is not the last `'/**'` +function (_, index, str) { + return index + 6 < str.length // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches + // > zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' // case: /** + // > A trailing `"/**"` matches everything inside. + // #21: everything inside but it should not include the current folder + : '\\/.+'; +}], // intermediate wildcards +[// Never replace escaped '*' +// ignore rule '\*' will match the path '*' +// 'abc.*/' -> go +// 'abc.*' -> skip this rule +/(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js' +// '*.js' doesn't match 'abc' +function (_, p1) { + return "".concat(p1, "[^\\/]*"); +}], // trailing wildcard +[/(\^|\\\/)?\\\*$/, function (_, p1) { + var prefix = p1 // '\^': + // '/*' does not match '' + // '/*' does not match everything + // '\\\/': + // 'abc/*' does not match 'abc/' + ? "".concat(p1, "[^/]+") // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*'; + return "".concat(prefix, "(?=$|\\/$)"); +}], [// unescape +/\\\\\\/g, function () { + return '\\'; +}]]; // A simple cache, because an ignore rule only has only one certain meaning + +var regexCache = Object.create(null); // @param {pattern} + +var makeRegex = function makeRegex(pattern, negative, ignorecase) { + var r = regexCache[pattern]; + + if (r) { + return r; + } // const replacers = negative + // ? NEGATIVE_REPLACERS + // : POSITIVE_REPLACERS + + + var source = REPLACERS.reduce(function (prev, current) { + return prev.replace(current[0], current[1].bind(pattern)); + }, pattern); + return regexCache[pattern] = ignorecase ? new RegExp(source, 'i') : new RegExp(source); +}; + +var isString = function isString(subject) { + return typeof subject === 'string'; +}; // > A blank line matches no files, so it can serve as a separator for readability. + + +var checkPattern = function checkPattern(pattern) { + return pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0; +}; + +var splitPattern = function splitPattern(pattern) { + return pattern.split(REGEX_SPLITALL_CRLF); +}; + +var IgnoreRule = function IgnoreRule(origin, pattern, negative, regex) { + _classCallCheck(this, IgnoreRule); + + this.origin = origin; + this.pattern = pattern; + this.negative = negative; + this.regex = regex; +}; + +var createRule = function createRule(pattern, ignorecase) { + var origin = pattern; + var negative = false; // > An optional prefix "!" which negates the pattern; + + if (pattern.indexOf('!') === 0) { + negative = true; + pattern = pattern.substr(1); + } + + pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#'); + var regex = makeRegex(pattern, negative, ignorecase); + return new IgnoreRule(origin, pattern, negative, regex); +}; + +var throwError = function throwError(message, Ctor) { + throw new Ctor(message); +}; + +var checkPath = function checkPath(path, originalPath, doThrow) { + if (!isString(path)) { + return doThrow("path must be a string, but got `".concat(originalPath, "`"), TypeError); + } // We don't know if we should ignore '', so throw + + + if (!path) { + return doThrow("path must not be empty", TypeError); + } // Check if it is a relative path + + + if (checkPath.isNotRelative(path)) { + var r = '`path.relative()`d'; + return doThrow("path should be a ".concat(r, " string, but got \"").concat(originalPath, "\""), RangeError); + } + + return true; +}; + +var isNotRelative = function isNotRelative(path) { + return REGEX_TEST_INVALID_PATH.test(path); +}; + +checkPath.isNotRelative = isNotRelative; + +checkPath.convert = function (p) { + return p; +}; + +var Ignore = +/*#__PURE__*/ +function () { + function Ignore() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$ignorecase = _ref.ignorecase, + ignorecase = _ref$ignorecase === void 0 ? true : _ref$ignorecase; + + _classCallCheck(this, Ignore); + + this._rules = []; + this._ignorecase = ignorecase; + define(this, KEY_IGNORE, true); + + this._initCache(); + } + + _createClass(Ignore, [{ + key: "_initCache", + value: function _initCache() { + this._ignoreCache = Object.create(null); + this._testCache = Object.create(null); + } + }, { + key: "_addPattern", + value: function _addPattern(pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules); + this._added = true; + return; + } + + if (checkPattern(pattern)) { + var rule = createRule(pattern, this._ignorecase); + this._added = true; + + this._rules.push(rule); + } + } // @param {Array | string | Ignore} pattern + + }, { + key: "add", + value: function add(pattern) { + this._added = false; + makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore, + // making the behavior changed. + + if (this._added) { + this._initCache(); + } + + return this; + } // legacy + + }, { + key: "addPattern", + value: function addPattern(pattern) { + return this.add(pattern); + } // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. + // @returns {TestResult} true if a file is ignored + + }, { + key: "_testOne", + value: function _testOne(path, checkUnignored) { + var ignored = false; + var unignored = false; + + this._rules.forEach(function (rule) { + var negative = rule.negative; + + if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) { + return; + } + + var matched = rule.regex.test(path); + + if (matched) { + ignored = !negative; + unignored = negative; + } + }); + + return { + ignored: ignored, + unignored: unignored + }; + } // @returns {TestResult} + + }, { + key: "_test", + value: function _test(originalPath, cache, checkUnignored, slices) { + var path = originalPath // Supports nullable path + && checkPath.convert(originalPath); + checkPath(path, originalPath, throwError); + return this._t(path, cache, checkUnignored, slices); + } + }, { + key: "_t", + value: function _t(path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path]; + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH); + } + + slices.pop(); // If the path has no parent directory, just test it + + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored); + } + + var parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices); // If the path contains a parent directory, check the parent first + + + return cache[path] = parent.ignored // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent : this._testOne(path, checkUnignored); + } + }, { + key: "ignores", + value: function ignores(path) { + return this._test(path, this._ignoreCache, false).ignored; + } + }, { + key: "createFilter", + value: function createFilter() { + var _this = this; + + return function (path) { + return !_this.ignores(path); + }; + } + }, { + key: "filter", + value: function filter(paths) { + return makeArray(paths).filter(this.createFilter()); + } // @returns {TestResult} + + }, { + key: "test", + value: function test(path) { + return this._test(path, this._testCache, true); + } + }]); + + return Ignore; +}(); + +var factory = function factory(options) { + return new Ignore(options); +}; + +var returnFalse = function returnFalse() { + return false; +}; + +var isPathValid = function isPathValid(path) { + return checkPath(path && checkPath.convert(path), path, returnFalse); +}; + +factory.isPathValid = isPathValid; // Fixes typescript + +factory["default"] = factory; +module.exports = factory; // Windows +// -------------------------------------------------------------- + +/* istanbul ignore if */ + +if ( // Detect `process` so that it can run in browsers. +typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) { + /* eslint no-control-regex: "off" */ + var makePosix = function makePosix(str) { + return /^\\\\\?\\/.test(str) || /[\0-\x1F"<>\|]+/.test(str) ? str : str.replace(/\\/g, '/'); + }; + + checkPath.convert = makePosix; // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + + var REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i; + + checkPath.isNotRelative = function (path) { + return REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path); + }; +} diff --git a/node_modules/ignore/package.json b/node_modules/ignore/package.json new file mode 100644 index 000000000..9641512d4 --- /dev/null +++ b/node_modules/ignore/package.json @@ -0,0 +1,98 @@ +{ + "_from": "ignore@^5.0.5", + "_id": "ignore@5.1.4", + "_inBundle": false, + "_integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "_location": "/ignore", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ignore@^5.0.5", + "name": "ignore", + "escapedName": "ignore", + "rawSpec": "^5.0.5", + "saveSpec": null, + "fetchSpec": "^5.0.5" + }, + "_requiredBy": [ + "/glob-gitignore" + ], + "_resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", + "_shasum": "84b7b3dbe64552b6ef0eca99f6743dbec6d97adf", + "_spec": "ignore@^5.0.5", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob-gitignore", + "author": { + "name": "kael" + }, + "bugs": { + "url": "https://github.com/kaelzhang/node-ignore/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.", + "devDependencies": { + "@babel/cli": "^7.5.5", + "@babel/core": "^7.5.5", + "@babel/preset-env": "^7.5.5", + "codecov": "^3.5.0", + "debug": "^4.1.1", + "eslint": "^6.1.0", + "eslint-config-ostai": "^3.0.0", + "eslint-plugin-import": "^2.18.2", + "mkdirp": "^0.5.1", + "pre-suf": "^1.1.1", + "rimraf": "^2.7.0", + "spawn-sync": "^2.0.0", + "tap": "^14.6.1", + "tmp": "0.1.0", + "typescript": "^3.5.3" + }, + "engines": { + "node": ">= 4" + }, + "files": [ + "legacy.js", + "index.js", + "index.d.ts", + "LICENSE-MIT" + ], + "homepage": "https://github.com/kaelzhang/node-ignore#readme", + "keywords": [ + "ignore", + ".gitignore", + "gitignore", + "npmignore", + "rules", + "manager", + "filter", + "regexp", + "regex", + "fnmatch", + "glob", + "asterisks", + "regular-expression" + ], + "license": "MIT", + "name": "ignore", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/kaelzhang/node-ignore.git" + }, + "scripts": { + "build": "babel -o legacy.js index.js", + "posttest": "tap --coverage-report=html && codecov", + "prepublishOnly": "npm run build", + "test": "npm run test:only", + "test:cases": "tap test/*.js --coverage", + "test:git": "tap test/git-check-ignore.js", + "test:ignore": "tap test/ignore.js", + "test:lint": "eslint .", + "test:only": "npm run test:lint && npm run test:tsc && npm run test:ts && npm run test:cases", + "test:others": "tap test/others.js", + "test:ts": "node ./test/ts/simple.js", + "test:tsc": "tsc ./test/ts/simple.ts --lib ES6", + "test:win32": "IGNORE_TEST_WIN32=1 npm run test" + }, + "version": "5.1.4" +} diff --git a/node_modules/inflight/LICENSE b/node_modules/inflight/LICENSE new file mode 100644 index 000000000..05eeeb88c --- /dev/null +++ b/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/inflight/README.md b/node_modules/inflight/README.md new file mode 100644 index 000000000..6dc892917 --- /dev/null +++ b/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/node_modules/inflight/inflight.js b/node_modules/inflight/inflight.js new file mode 100644 index 000000000..48202b3ca --- /dev/null +++ b/node_modules/inflight/inflight.js @@ -0,0 +1,54 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/node_modules/inflight/package.json b/node_modules/inflight/package.json new file mode 100644 index 000000000..91757ad34 --- /dev/null +++ b/node_modules/inflight/package.json @@ -0,0 +1,58 @@ +{ + "_from": "inflight@^1.0.4", + "_id": "inflight@1.0.6", + "_inBundle": false, + "_integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "_location": "/inflight", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "inflight@^1.0.4", + "name": "inflight", + "escapedName": "inflight", + "rawSpec": "^1.0.4", + "saveSpec": null, + "fetchSpec": "^1.0.4" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9", + "_spec": "inflight@^1.0.4", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "bundleDependencies": false, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "deprecated": false, + "description": "Add callbacks to requests in flight to avoid async duplication", + "devDependencies": { + "tap": "^7.1.2" + }, + "files": [ + "inflight.js" + ], + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC", + "main": "inflight.js", + "name": "inflight", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/inflight.git" + }, + "scripts": { + "test": "tap test.js --100" + }, + "version": "1.0.6" +} diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE new file mode 100644 index 000000000..dea3013d6 --- /dev/null +++ b/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/inherits/README.md b/node_modules/inherits/README.md new file mode 100644 index 000000000..b1c566585 --- /dev/null +++ b/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js new file mode 100644 index 000000000..f71f2d932 --- /dev/null +++ b/node_modules/inherits/inherits.js @@ -0,0 +1,9 @@ +try { + var util = require('util'); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = require('./inherits_browser.js'); +} diff --git a/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js new file mode 100644 index 000000000..86bbb3dc2 --- /dev/null +++ b/node_modules/inherits/inherits_browser.js @@ -0,0 +1,27 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json new file mode 100644 index 000000000..654fdc6ac --- /dev/null +++ b/node_modules/inherits/package.json @@ -0,0 +1,61 @@ +{ + "_from": "inherits@2", + "_id": "inherits@2.0.4", + "_inBundle": false, + "_integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "_location": "/inherits", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "inherits@2", + "name": "inherits", + "escapedName": "inherits", + "rawSpec": "2", + "saveSpec": null, + "fetchSpec": "2" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "_shasum": "0fa2c64f932917c3433a0ded55363aae37416b7c", + "_spec": "inherits@2", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob", + "browser": "./inherits_browser.js", + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "devDependencies": { + "tap": "^14.2.4" + }, + "files": [ + "inherits.js", + "inherits_browser.js" + ], + "homepage": "https://github.com/isaacs/inherits#readme", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "license": "ISC", + "main": "./inherits.js", + "name": "inherits", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits.git" + }, + "scripts": { + "test": "tap" + }, + "version": "2.0.4" +} diff --git a/node_modules/lodash.difference/LICENSE b/node_modules/lodash.difference/LICENSE new file mode 100644 index 000000000..e0c69d560 --- /dev/null +++ b/node_modules/lodash.difference/LICENSE @@ -0,0 +1,47 @@ +Copyright jQuery Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/node_modules/lodash.difference/README.md b/node_modules/lodash.difference/README.md new file mode 100644 index 000000000..be954fd81 --- /dev/null +++ b/node_modules/lodash.difference/README.md @@ -0,0 +1,18 @@ +# lodash.difference v4.5.0 + +The [lodash](https://lodash.com/) method `_.difference` exported as a [Node.js](https://nodejs.org/) module. + +## Installation + +Using npm: +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.difference +``` + +In Node.js: +```js +var difference = require('lodash.difference'); +``` + +See the [documentation](https://lodash.com/docs#difference) or [package source](https://github.com/lodash/lodash/blob/4.5.0-npm-packages/lodash.difference) for more details. diff --git a/node_modules/lodash.difference/index.js b/node_modules/lodash.difference/index.js new file mode 100644 index 000000000..4c0b61f7b --- /dev/null +++ b/node_modules/lodash.difference/index.js @@ -0,0 +1,1170 @@ +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; +} + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array ? array.length : 0, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +/** + * Checks if a cache value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var Symbol = root.Symbol, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'), + nativeCreate = getNative(Object, 'create'); + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +/** + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + */ +function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; + } + if (iteratee) { + values = arrayMap(values, baseUnary(iteratee)); + } + if (comparator) { + includes = arrayIncludesWith; + isCommon = false; + } + else if (values.length >= LARGE_ARRAY_SIZE) { + includes = cacheHas; + isCommon = false; + values = new SetCache(values); + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; + } + } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } + return result; +} + +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); +} + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order of result values is determined by the + * order they occur in the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ +var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; +}); + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +module.exports = difference; diff --git a/node_modules/lodash.difference/package.json b/node_modules/lodash.difference/package.json new file mode 100644 index 000000000..9a3026422 --- /dev/null +++ b/node_modules/lodash.difference/package.json @@ -0,0 +1,69 @@ +{ + "_from": "lodash.difference@^4.5.0", + "_id": "lodash.difference@4.5.0", + "_inBundle": false, + "_integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=", + "_location": "/lodash.difference", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "lodash.difference@^4.5.0", + "name": "lodash.difference", + "escapedName": "lodash.difference", + "rawSpec": "^4.5.0", + "saveSpec": null, + "fetchSpec": "^4.5.0" + }, + "_requiredBy": [ + "/glob-gitignore" + ], + "_resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "_shasum": "9ccb4e505d486b91651345772885a2df27fd017c", + "_spec": "lodash.difference@^4.5.0", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob-gitignore", + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com", + "url": "https://github.com/phated" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "deprecated": false, + "description": "The lodash method `_.difference` exported as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "keywords": [ + "lodash-modularized", + "difference" + ], + "license": "MIT", + "name": "lodash.difference", + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "version": "4.5.0" +} diff --git a/node_modules/lodash.union/LICENSE b/node_modules/lodash.union/LICENSE new file mode 100644 index 000000000..e0c69d560 --- /dev/null +++ b/node_modules/lodash.union/LICENSE @@ -0,0 +1,47 @@ +Copyright jQuery Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/node_modules/lodash.union/README.md b/node_modules/lodash.union/README.md new file mode 100644 index 000000000..001092dde --- /dev/null +++ b/node_modules/lodash.union/README.md @@ -0,0 +1,18 @@ +# lodash.union v4.6.0 + +The [lodash](https://lodash.com/) method `_.union` exported as a [Node.js](https://nodejs.org/) module. + +## Installation + +Using npm: +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.union +``` + +In Node.js: +```js +var union = require('lodash.union'); +``` + +See the [documentation](https://lodash.com/docs#union) or [package source](https://github.com/lodash/lodash/blob/4.6.0-npm-packages/lodash.union) for more details. diff --git a/node_modules/lodash.union/index.js b/node_modules/lodash.union/index.js new file mode 100644 index 000000000..d1eb0305d --- /dev/null +++ b/node_modules/lodash.union/index.js @@ -0,0 +1,1181 @@ +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; +} + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * Checks if a cache value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ +function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var Symbol = root.Symbol, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'), + Set = getNative(root, 'Set'), + nativeCreate = getNative(Object, 'create'); + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + +/** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ +function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } + else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache; + } + else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; +} + +/** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ +var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { + return new Set(values); +}; + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); +} + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Creates an array of unique values, in order, from all given arrays using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([2], [1, 2]); + * // => [2, 1] + */ +var union = baseRest(function(arrays) { + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); +}); + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ +function noop() { + // No operation performed. +} + +module.exports = union; diff --git a/node_modules/lodash.union/package.json b/node_modules/lodash.union/package.json new file mode 100644 index 000000000..7b5ca6bf5 --- /dev/null +++ b/node_modules/lodash.union/package.json @@ -0,0 +1,69 @@ +{ + "_from": "lodash.union@^4.6.0", + "_id": "lodash.union@4.6.0", + "_inBundle": false, + "_integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=", + "_location": "/lodash.union", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "lodash.union@^4.6.0", + "name": "lodash.union", + "escapedName": "lodash.union", + "rawSpec": "^4.6.0", + "saveSpec": null, + "fetchSpec": "^4.6.0" + }, + "_requiredBy": [ + "/glob-gitignore" + ], + "_resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", + "_shasum": "48bb5088409f16f1821666641c44dd1aaae3cd88", + "_spec": "lodash.union@^4.6.0", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob-gitignore", + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com", + "url": "https://github.com/phated" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "deprecated": false, + "description": "The lodash method `_.union` exported as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "keywords": [ + "lodash-modularized", + "union" + ], + "license": "MIT", + "name": "lodash.union", + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "version": "4.6.0" +} diff --git a/node_modules/make-array/README.md b/node_modules/make-array/README.md new file mode 100644 index 000000000..b21d4fdf5 --- /dev/null +++ b/node_modules/make-array/README.md @@ -0,0 +1,61 @@ +[![NPM version](https://badge.fury.io/js/make-array.svg)](http://badge.fury.io/js/make-array) +[![Build Status](https://travis-ci.org/kaelzhang/make-array.svg?branch=master)](https://travis-ci.org/kaelzhang/make-array) + +# make-array + +Creates a real Array from almost anything. + +## Install + +```bash +$ npm i make-array --save +``` + +## Usage + +```js +var makeArray = require('make-array'); +makeArray(); // [] +makeArray(undefined); // [] +makeArray(null); // [] +makeArray(1); // [1] +makeArray([1, 2]); // [1, 2] +makeArray({ + '0': 1, + '1': 2, + length: 2 +}); // [1, 2] + +function foo (){ + return makeArray(arguments); +} + +foo(1, 2, 3); // [1, 2, 3] +``` + +### makeArray(subject, [host]) + +- subject `mixed` things you want to make it an array +- host `Array=` if `host` is specified, the newly-created array will append to the end of the `host` + +Returns `Array`. If `host` is specified, it will return the `host` itself. + +```js +var host = [1, 2]; +function foo(){ + return arguments; +} + +var result = makeArray(foo({}, []), host); +result; // [1, 2, {}, []]; +result === host; // true +``` + +## Changelog + +**1.0.0**: bump version to mark it as stable. + +## License + +MIT + diff --git a/node_modules/make-array/index.js b/node_modules/make-array/index.js new file mode 100644 index 000000000..37470d3a8 --- /dev/null +++ b/node_modules/make-array/index.js @@ -0,0 +1,71 @@ +// @param {all} subject +// if nodelist, returns an array which generated from the nodelist +// if Array, returns the array itself +// otherwise, returns an array contains the subject +// @param {Array=} host +module.exports = function (subject, host) { + // false -> [false] + // null -> [] + // undefined -> makeArray() -> [] + if (subject === undefined || subject === null) { + return host || [] + } + + // if is already an array + if (isArray(subject)) { + return host + ? host.concat(subject) + : subject + } + + host || (host = []) + if (isArrayLikeObject(subject)) { + // IE fails on collections and ) + // use subject clone instead of Array.prototype.slice + clonePureArray(subject, host) + + } else { + host.push(subject) + } + + return host +} + +var toString = Object.prototype.toString +function isArray (subject) { + return toString.call(subject) === '[object Array]' +} + +// altered from jQuery +function isArrayLikeObject (subject) { + var length = subject.length + + if ( + typeof subject === 'function' + || Object(subject) !== subject + || typeof length !== 'number' + // `window` already has a property `length` + || 'setInterval' in subject + ) { + return false + } + + return length === 0 + || length > 0 && (length - 1) in subject +} + +/** + * clone an object as a pure subject, and ignore non-number properties + * @param {Array} subject + * @param {Array|Object} host required, receiver which the subject be cloned to + */ +function clonePureArray (subject, host) { + var i = subject.length + var start = host.length + + while (i --) { + host[start + i] = subject[i] + } + + return host +} diff --git a/node_modules/make-array/package.json b/node_modules/make-array/package.json new file mode 100644 index 000000000..31176ccae --- /dev/null +++ b/node_modules/make-array/package.json @@ -0,0 +1,69 @@ +{ + "_from": "make-array@^1.0.5", + "_id": "make-array@1.0.5", + "_inBundle": false, + "_integrity": "sha512-sgK2SAzxT19rWU+qxKUcn6PAh/swiIiz2F8C2cZjLc1z4iwYIfdoihqFIDQ8BDzAGtWPYJ6Sr13K1j/DXynDLA==", + "_location": "/make-array", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "make-array@^1.0.5", + "name": "make-array", + "escapedName": "make-array", + "rawSpec": "^1.0.5", + "saveSpec": null, + "fetchSpec": "^1.0.5" + }, + "_requiredBy": [ + "/glob-gitignore" + ], + "_resolved": "https://registry.npmjs.org/make-array/-/make-array-1.0.5.tgz", + "_shasum": "326a7635c756a9f61ce0b2a6fdd5cc3460419bcb", + "_spec": "make-array@^1.0.5", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob-gitignore", + "author": { + "name": "kael" + }, + "bugs": { + "url": "https://github.com/kaelzhang/make-array/issues" + }, + "bundleDependencies": false, + "cortex": { + "devDependencies": { + "chai": "*" + } + }, + "deprecated": false, + "description": "Creates a real Array from almost anything.", + "devDependencies": { + "chai": "*", + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/kaelzhang/make-array#readme", + "keywords": [ + "make-array", + "to-array", + "makearray", + "toarray", + "array", + "iterate" + ], + "license": "MIT", + "main": "index.js", + "name": "make-array", + "repository": { + "type": "git", + "url": "git://github.com/kaelzhang/make-array.git" + }, + "scripts": { + "test": "sh test.sh" + }, + "version": "1.0.5" +} diff --git a/node_modules/minimatch/LICENSE b/node_modules/minimatch/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/minimatch/README.md b/node_modules/minimatch/README.md new file mode 100644 index 000000000..ad72b8133 --- /dev/null +++ b/node_modules/minimatch/README.md @@ -0,0 +1,209 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js new file mode 100644 index 000000000..5b5f8cf44 --- /dev/null +++ b/node_modules/minimatch/minimatch.js @@ -0,0 +1,923 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long') + } + + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/node_modules/minimatch/package.json b/node_modules/minimatch/package.json new file mode 100644 index 000000000..7e987e1ce --- /dev/null +++ b/node_modules/minimatch/package.json @@ -0,0 +1,63 @@ +{ + "_from": "minimatch@^3.0.4", + "_id": "minimatch@3.0.4", + "_inBundle": false, + "_integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "_location": "/minimatch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "minimatch@^3.0.4", + "name": "minimatch", + "escapedName": "minimatch", + "rawSpec": "^3.0.4", + "saveSpec": null, + "fetchSpec": "^3.0.4" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "_shasum": "5166e286457f03306064be5497e8dbb0c3d32083", + "_spec": "minimatch@^3.0.4", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "bundleDependencies": false, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "deprecated": false, + "description": "a glob matcher in javascript", + "devDependencies": { + "tap": "^10.3.2" + }, + "engines": { + "node": "*" + }, + "files": [ + "minimatch.js" + ], + "homepage": "https://github.com/isaacs/minimatch#readme", + "license": "ISC", + "main": "minimatch.js", + "name": "minimatch", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --cov" + }, + "version": "3.0.4" +} diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/once/README.md b/node_modules/once/README.md new file mode 100644 index 000000000..1f1ffca93 --- /dev/null +++ b/node_modules/once/README.md @@ -0,0 +1,79 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` + +## `once.strict(func)` + +Throw an error if the function is called twice. + +Some functions are expected to be called only once. Using `once` for them would +potentially hide logical errors. + +In the example below, the `greet` function has to call the callback only once: + +```javascript +function greet (name, cb) { + // return is missing from the if statement + // when no name is passed, the callback is called twice + if (!name) cb('Hello anonymous') + cb('Hello ' + name) +} + +function log (msg) { + console.log(msg) +} + +// this will print 'Hello anonymous' but the logical error will be missed +greet(null, once(msg)) + +// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time +greet(null, once.strict(msg)) +``` diff --git a/node_modules/once/once.js b/node_modules/once/once.js new file mode 100644 index 000000000..235406736 --- /dev/null +++ b/node_modules/once/once.js @@ -0,0 +1,42 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} diff --git a/node_modules/once/package.json b/node_modules/once/package.json new file mode 100644 index 000000000..b55f1857e --- /dev/null +++ b/node_modules/once/package.json @@ -0,0 +1,67 @@ +{ + "_from": "once@^1.3.0", + "_id": "once@1.4.0", + "_inBundle": false, + "_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "_location": "/once", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "once@^1.3.0", + "name": "once", + "escapedName": "once", + "rawSpec": "^1.3.0", + "saveSpec": null, + "fetchSpec": "^1.3.0" + }, + "_requiredBy": [ + "/glob", + "/inflight" + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1", + "_spec": "once@^1.3.0", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "bundleDependencies": false, + "dependencies": { + "wrappy": "1" + }, + "deprecated": false, + "description": "Run a function exactly one time", + "devDependencies": { + "tap": "^7.0.1" + }, + "directories": { + "test": "test" + }, + "files": [ + "once.js" + ], + "homepage": "https://github.com/isaacs/once#readme", + "keywords": [ + "once", + "function", + "one", + "single" + ], + "license": "ISC", + "main": "once.js", + "name": "once", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "1.4.0" +} diff --git a/node_modules/path-is-absolute/index.js b/node_modules/path-is-absolute/index.js new file mode 100644 index 000000000..22aa6c356 --- /dev/null +++ b/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +} + +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/node_modules/path-is-absolute/license b/node_modules/path-is-absolute/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/path-is-absolute/package.json b/node_modules/path-is-absolute/package.json new file mode 100644 index 000000000..f2bb1a36d --- /dev/null +++ b/node_modules/path-is-absolute/package.json @@ -0,0 +1,75 @@ +{ + "_from": "path-is-absolute@^1.0.0", + "_id": "path-is-absolute@1.0.1", + "_inBundle": false, + "_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "_location": "/path-is-absolute", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "path-is-absolute@^1.0.0", + "name": "path-is-absolute", + "escapedName": "path-is-absolute", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", + "_spec": "path-is-absolute@^1.0.0", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/path-is-absolute/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "devDependencies": { + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/path-is-absolute#readme", + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "license": "MIT", + "name": "path-is-absolute", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/path-is-absolute.git" + }, + "scripts": { + "test": "xo && node test.js" + }, + "version": "1.0.1" +} diff --git a/node_modules/path-is-absolute/readme.md b/node_modules/path-is-absolute/readme.md new file mode 100644 index 000000000..8dbdf5fcb --- /dev/null +++ b/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/util.inherits/HISTORY.md b/node_modules/util.inherits/HISTORY.md new file mode 100644 index 000000000..e061a5372 --- /dev/null +++ b/node_modules/util.inherits/HISTORY.md @@ -0,0 +1 @@ +# History diff --git a/node_modules/util.inherits/README.md b/node_modules/util.inherits/README.md new file mode 100644 index 000000000..29b690a9d --- /dev/null +++ b/node_modules/util.inherits/README.md @@ -0,0 +1,45 @@ +[![Build Status](https://travis-ci.org/kaelzhang/node-util-inherits.svg?branch=master)](https://travis-ci.org/kaelzhang/node-util-inherits) + + + + + +# util-inherits + +util.inherits with compatibility. + +`util-inherits` will try use `Object.setPrototypeOf`, if `Object.setPrototypeOf` is not supported, then `Object.create`, or manipulate prototype. + +- Browser friendly. +- Does not rely on node utilities + +## Install + +```sh +$ npm install util.inherits --save +``` + +## Usage + +```js +const inherits = require('util.inherits') +const {EventEmitter} = require('events') + +function MyClass () { + // code ... +} + +inherits(MyClass, EventEmitter) +``` + +## License + +MIT diff --git a/node_modules/util.inherits/index.js b/node_modules/util.inherits/index.js new file mode 100644 index 000000000..fe15734b6 --- /dev/null +++ b/node_modules/util.inherits/index.js @@ -0,0 +1,47 @@ +const inherits = typeof Object.setPrototypeOf === 'function' + ? function (ctor, superCtor) { + ctor.super_ = superCtor + Object.setPrototypeOf(ctor.prototype, superCtor.prototype) + } + + : typeof Object.create === 'function' + ? function (ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + + : function (ctor, superCtor) { + ctor.super_ = superCtor + function F () {} + F.prototype = superCtor.prototype + ctor.prototype = new F + ctor.prototype.constructor = ctor + } + + +module.exports = function (ctor, superCtor) { + + if (ctor === undefined || ctor === null) { + throw new TypeError('The constructor to "inherits" must not be ' + + 'null or undefined') + } + + if (superCtor === undefined || superCtor === null) { + throw new TypeError('The super constructor to "inherits" must not ' + + 'be null or undefined') + } + + if (superCtor.prototype === undefined) { + throw new TypeError('The super constructor to "inherits" must ' + + 'have a prototype') + } + + inherits(ctor, superCtor) +} diff --git a/node_modules/util.inherits/package.json b/node_modules/util.inherits/package.json new file mode 100644 index 000000000..9f831d5d8 --- /dev/null +++ b/node_modules/util.inherits/package.json @@ -0,0 +1,81 @@ +{ + "_from": "util.inherits@^1.0.3", + "_id": "util.inherits@1.0.3", + "_inBundle": false, + "_integrity": "sha1-qcYmoNBtNIKdR7pWyrEnjXRfnOY=", + "_location": "/util.inherits", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "util.inherits@^1.0.3", + "name": "util.inherits", + "escapedName": "util.inherits", + "rawSpec": "^1.0.3", + "saveSpec": null, + "fetchSpec": "^1.0.3" + }, + "_requiredBy": [ + "/glob-gitignore" + ], + "_resolved": "https://registry.npmjs.org/util.inherits/-/util.inherits-1.0.3.tgz", + "_shasum": "a9c626a0d06d34829d47ba56cab1278d745f9ce6", + "_spec": "util.inherits@^1.0.3", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\glob-gitignore", + "author": { + "name": "kaelzhang" + }, + "ava": { + "require": "babel-register", + "babel": { + "babelrc": true + }, + "files": [ + "test.js" + ] + }, + "bugs": { + "url": "https://github.com/kaelzhang/node-util-inherits/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "util.inherits with compatibility", + "devDependencies": { + "ava": "^0.16.0", + "babel-plugin-syntax-trailing-function-commas": "^6.13.0", + "babel-plugin-transform-async-to-generator": "^6.22.0", + "babel-plugin-transform-class-properties": "^6.16.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.16.0", + "babel-plugin-transform-exponentiation-operator": "^6.8.0", + "babel-plugin-transform-inline-environment-variables": "^6.8.0", + "babel-plugin-transform-object-rest-spread": "^6.16.0", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-preset-es2015": "^6.16.0", + "babel-register": "^6.24.1" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/kaelzhang/node-util-inherits#readme", + "keywords": [ + "util-inherits", + "inherits", + "class-extends", + "extend", + "legacy" + ], + "license": "MIT", + "main": "index.js", + "name": "util.inherits", + "repository": { + "type": "git", + "url": "git://github.com/kaelzhang/node-util-inherits.git" + }, + "scripts": { + "test": "node --harmony ./node_modules/.bin/ava --verbose --timeout=10s" + }, + "version": "1.0.3" +} diff --git a/node_modules/wrappy/LICENSE b/node_modules/wrappy/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/wrappy/README.md b/node_modules/wrappy/README.md new file mode 100644 index 000000000..98eab2522 --- /dev/null +++ b/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/wrappy/package.json b/node_modules/wrappy/package.json new file mode 100644 index 000000000..c061eb38d --- /dev/null +++ b/node_modules/wrappy/package.json @@ -0,0 +1,59 @@ +{ + "_from": "wrappy@1", + "_id": "wrappy@1.0.2", + "_inBundle": false, + "_integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "_location": "/wrappy", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "wrappy@1", + "name": "wrappy", + "escapedName": "wrappy", + "rawSpec": "1", + "saveSpec": null, + "fetchSpec": "1" + }, + "_requiredBy": [ + "/inflight", + "/once" + ], + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "_shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", + "_spec": "wrappy@1", + "_where": "C:\\Users\\ShadowMoose\\Documents\\Git\\LoC-Badge\\node_modules\\inflight", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Callback wrapping utility", + "devDependencies": { + "tap": "^2.3.1" + }, + "directories": { + "test": "test" + }, + "files": [ + "wrappy.js" + ], + "homepage": "https://github.com/npm/wrappy", + "license": "ISC", + "main": "wrappy.js", + "name": "wrappy", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/wrappy.git" + }, + "scripts": { + "test": "tap --coverage test/*.js" + }, + "version": "1.0.2" +} diff --git a/node_modules/wrappy/wrappy.js b/node_modules/wrappy/wrappy.js new file mode 100644 index 000000000..bb7e7d6fc --- /dev/null +++ b/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +}